Troubleshoot reportlab heisenbug

拈花ヽ惹草 提交于 2020-01-01 10:17:24

问题


Using Django 1.4 / Python 2.7 / reportlab (open source version) to generate pdf.

Things have worked really great up until now. Previously pdf generation (as in http requested returned/downloaded generated pdf file) was on Django 1.3 and not open for public. Have upgraded and made feature free on many pages and now starting to have problems.

I get 'random' problems (as in I see there are exceptions once in a while in logs) but I have never been able to reproduce problems myself (things works most of the time).

What I get is the following type of errors that always happens in pairs

    Exception Value: ParaParser instance has no attribute '_seq'
    Exception Location: /home/tss/lib/python2.7/reportlab-2.5-py2.7-linux-i686.egg/reportlab/platypus/paraparser.py in _complete_parse, line 1061

and then

    Exception Value: 'NoneType' object has no attribute 'close'
    Exception Location: /home/tss/lib/python2.7/reportlab-2.5-py2.7-linux-i686.egg/reportlab/lib/xmllib.py in close, line 521

Given that I am having a hard time reproducing this and not sure if problem on my side or reportlab - I am open for suggestions on how to troubleshoot this (could it be sync issue as in many generating conccurently or just a plain bug or...)???


回答1:


Posted this question on the reportlab mailing list and Reportlab is not thread-safe.

So any usage of reportlab where you end up getting intermittent problems and are running in a multithread / web app environment you will get really really strange problems due to this.

Now I need to work out what to replace reportlab with, hmm....

/ Jens



来源:https://stackoverflow.com/questions/10899078/troubleshoot-reportlab-heisenbug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!