[reportlab-users] Thread safety of reportlab?

Robin Becker robin at reportlab.com
Fri Dec 2 10:27:06 EST 2011


On 02/12/2011 14:56, Werner Thie wrote:

> On 02.12.2011 15:42, Stephan Richter wrote:

>> On Friday, December 02, 2011 08:43:23 AM Andy Robinson wrote:

>>> People have been using it in long-running web architectures for years

>>> with no complaints.

>>> As far as we know, ReportLab is thread-safe if used sensibly. By this

>>> I mean that you should construct a new story, doctemplate and content

>>> for each job, and don't try to share objects between documents. In

>>> our commercial product, RML, we construct the entire object graph for

>>> every job.

>>

>> Well, we have found this not to be true. :-) Even the z3c.rml tests did not

>> run cleanly, because state is not properly cleaned up. I have not played with

>> ReportLab recently though.

>>

>> We solved the issue by running report generation in its own sub-process. You

>> can look at the z3c.rml code how to do this. But then Werner already uses

>> z3c.rml, so I guess he is aware of this. :-)

>>

>> Regards,

>> Stephan

>

> Hmm, will report back with my mileage...

>

> Werner

.........

There are hooks in the rl_config that are supposed to clean up most of the
state, but even that won't prevent two simultaneous requests smashing up the
lists in reportlab.pdfbase.pdfmetrics. The C extensions are also likely to be an
area where stuff goes bad.
--
Robin Becker


More information about the reportlab-users mailing list