Re: IndexError exception in platypus.paraparser

Robin Becker <[email protected]>
Newsgroups gmane.comp.python.reportlab.user
Message-ID <CAOBYczrvGoAEc4nO6qOyn-wqG27HiXONDcsdq-4Gu1ENRVcY-A@mail.gmail.com>
Hi Germán, I don't believe we have ever claimed that we are threads
afe; in fact I believe we have always said the RL code is not. Besides
your example we have many instances of module global variables which
are used in simple ways ie font dictionaries and the like.

Since PDF production is likely a heavy user we have recommended using
a queue or an external process to guarantee single thread behaviour.
Our django projects never use the threaded model always forking.

On 31 December 2015 at 07:35, Germán M. Bravo <[email protected]> wrote:
> I'm working with ReportLab in a threaded environment and I've been getting a
> weird exception about IndexError when doing some operations such as _pop()
> during platypus.paraparser.ParaParser.end_br(). I think I've tracked the
> error down the fact _stack is a member of the TTParser instance (using
> rml2pdf).
>
> After googling around, I found a place where the source code of rml2pdf
> shows this:
>
> class TTParagraphMixin:
>     _CLEAN_SPACE = 0
>     _parser = TTParser()
>     ...
>
> Then, doing:
>
> from rlextra.rml2pdf import rml2pdf
> print(repr(rml2pdf.TTParagraphMixin._parser))
>
> confirms TTParser is an instance: <rlextra.rml2pdf.rml2pdf.TTParser instance
> at 0x1053eae18>
>
> This means TTParser instance there is an instance placed as a property of
> TTParagraphMixin at class level (which means it's shared by all instances of
> TTParagraph, TTXPreformatted and others) ...but (at least) TTParser._stack
> could be modified by several threads at the same time (causing the aforesaid
> exception to raise from time to time).
>
>
> _______________________________________________
> reportlab-users mailing list
> [email protected]
> https://pairlist2.pair.net/mailman/listinfo/reportlab-users
>



-- 
Robin Becker
_______________________________________________
reportlab-users mailing list
[email protected]
https://pairlist2.pair.net/mailman/listinfo/reportlab-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.