report_webkit not thread-safe: risk of document corruption
Bug #1290820 reported by
Florent
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
New
|
Undecided
|
Unassigned | |||
OpenERP Community Backports (Addons) | Status tracked in 7.0 | |||||
7.0 |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
While generating a high number of PDF (20 000) with report_webkit, we got a PDF generated with wrong content.
We tracked down the bug being a collision on temporary HTML files created by this module.
Our hotfix is: http://
Related branches
lp:~florent.x/openobject-addons/trunk-1290820-report_webkit
- Nicolas Bessi - Camptocamp (community): Disapprove
- OpenERP Core Team: Pending requested
-
Diff: 46 lines (+5/-3)1 file modifiedreport_webkit/webkit_report.py (+5/-3)
lp:~camptocamp/openobject-addons/7.0-fix-1319095
- Yannick Vaucher @ Camptocamp (community): Disapprove
- Nicolas Bessi - Camptocamp (community): Approve (no test, code review)
- OpenERP Core Team: Pending requested
-
Diff: 74 lines (+15/-25)1 file modifiedreport_webkit/webkit_report.py (+15/-25)
lp:~camptocamp/ocb-addons/7.0-fix-1319095
- Pedro Manuel Baeza: Approve (code review)
- Alexandre Fayolle - camptocamp: Approve (code review, no test)
- Nicolas Bessi - Camptocamp (community): Approve (no test, code review)
- Florent: Pending requested
-
Diff: 74 lines (+15/-25)1 file modifiedreport_webkit/webkit_report.py (+15/-25)
tags: | added: maintenance |
To post a comment you must log in.
Copy of hot fix for memory in order to do the MP on OCB and official
=== modified file 'report_ webkit/ webkit_ report. py' webkit/ webkit_ report. py 2013-10-27 12:31:04 +0000 webkit/ webkit_ report. py 2014-03-11 11:44:49 +0000
--- report_
+++ report_
@@ -35,6 +35,7 @@
import sys
from openerp import report
import tempfile
+import thread
import time
import logging
@@ -157,6 +158,7 @@
webkit_ header = report_ xml.webkit_ header gettempdir( )
out_filename = tempfile. mktemp( suffix= ".pdf", prefix= "webkit. tmp.") get_ident( ), 1e7 * time.time())
file_ to_del = [out_filename]
command = [comm_path]
head_ file = file( os.path.join(
tmp_dir,
) ,
'w'
)
foot_ file = file( os.path.join(
tmp_dir,
) ,
'w'
)
command. extend( ['--page- size', str(webkit_ header. format) .replace( ',', '.')]) path.join( tmp_dir, str(time.time()) + str(count) +'.body.html'), 'w') path.join( tmp_dir, timestamp + str(count) +'.body.html'), 'w')
html_ file.write( html.encode( 'utf-8' ))
html_ file.close( )
tmp_dir = tempfile.
+ timestamp = '%x.%x' % (thread.
if comm_path:
@@ -169,7 +171,7 @@
if header :
- str(time.time()) + '.head.html'
+ timestamp + '.head.html'
@@ -180,7 +182,7 @@
if footer :
- str(time.time()) + '.foot.html'
+ timestamp + '.foot.html'
@@ -203,7 +205,7 @@
count = 0
for html in html_list :
- html_file = file(os.
+ html_file = file(os.
count += 1