[reportlab-users] ReportLab & thread-safe issue - status?
robin at reportlab.com
Fri Nov 4 05:26:43 EDT 2016
I have answered questions on stackoverflow, but we prefer that any discussions
take place in the reportlab users list. There is good advice to be had there
from others than those that work directly on reportlab.
We have stated many times that reportlab is not thread safe.
There were issues in the paragraph parsing related to having just one parser at
the module level, but in modern reportlab we use a separate parser for each
That said, we have made no real effort to create a ReportLab class that could
encapsulate the whole state of a reportlab process. That means that there is
only one set of globals and they are not protected by local storage or locks etc
etc. The implication is that one thread could add a font and it wold then be
available to other threads etc etc.
My boss Andy Robinson has always said that document production should be handled
as a task separated from the web. The document production of even simple
documents takes significantly longer than a typical django request.
We do use reportlab to produce documents with django, but in production we use a
forking model so thread safety is not an issue. In addition for requests that
take a long time we also detach a producer process to handle the document task
which allows responsiveness and other benefits. even if the server process does
not have a time out many browsers, proxies & gateways will so a document that
takes more than 30 seconds will probably be created and then lost.
On 01/11/2016 11:15, "Yannick Gosteli"@PETZI wrote:
> Dear M. Becker,
> I would be happy to use ReportLab open-source for a project in our organization
> "PETZI" (non-profit organization for music clubs & festivals in Switzerland).
> I'm a bit worry about the "thread-safe" issue we can hear about in forums and
> especially in Django documentation
> I've been on touch with Jens Lundström about that who experiment this issue and
> gave me your contact.
> Jens said me you identify the problem as in xmllib. Did you fix it now?
> Do you have any status about the issue?
> Thx for your answer.
> Best regards
> Yannick Gosteli
> PS: If you have interest to answer directly to the community, I've posted a
> question for a status on StackOverflow
More information about the reportlab-users