[reportlab-users] Intermittent failure to find font, followed by IOError

Stevens, Ian IStevens at globeandmail.com
Wed Oct 28 15:45:26 EDT 2009


Thanks for taking the time to think about this issue, Robin. I admit it's an odd behaviour, especially seeing as though we never make use of that font or any fonts included with Reportlab. We also don't use the reportlab.graphics.testshapes module. It feels like a symptom of a larger problem.

The fonts are owned by root, but readable by everyone. If something were altering the rights for those files, then presumably the error would not have gone away when we changed MaxRequestsPerChild to 1.

With respect to multi-threading, I spoke to our operations dept. I had thought we were using Apache prefork, but they have it set up for worker instead. They had it set up with prefork at one point but apparently the errors still occurred, and were more frequent. I instructed them to switch back to prefork. The font errors immediately started coming through with increased frequency. That is odd as I would expect the errors to occur more under worker than prefork.

I'll check out the WSGI with flup option and see if that fixes things.

Thanks,
Ian.


> -----Original Message-----

> From: reportlab-users-bounces at lists2.reportlab.com

> [mailto:reportlab-users-bounces at lists2.reportlab.com] On

> Behalf Of Robin Becker

> Sent: October 28, 2009 7:02 AM

> To: Support list for users of Reportlab software

> Subject: Re: [reportlab-users] Intermittent failure to find

> font, followed by IOError

>

> Stevens, Ian wrote:

> > Hi all. Earlier this year, I posted a problem we had been

> having with our production servers.

> >

> ........

> > IOError: Cannot open resource

> "/usr/lib/python2.5/site-packages/reportlab/fonts/DarkGardenMK.afm"

> >

> ........

>

> If it helps, I can say that we used to run Django via

> mod_python, but did not see this particular issue.

>

> First off it seems particularly strange that you see

> DarkGardenMK.afm(or earlier

> LetError) mentioned. We include this font purely as an

> exemplar of a type 1 font. So far as I know none of the

> standard library code is actually using it. I believe it may

> be mentioned in reportlab/graphics/testshapes.py. Are you

> importing that module or are you explicitly using this font?

>

> Apache+mod_python presumably runs as a special user say www;

> does that

> Apache+cause any

> problems of reading etc etc?

>

> Secondly as your apache test seems to imply this may be a

> threading issue. The base ReportLab toolkit is not thread

> safe. Thus if one thread is in the process of reading a file

> when another thread attempts to open the same file it's

> entirely possible that something odd may happen. Calling the

> reset function may actually make things worse for

> multi-threaded programs.

>

> We run django using flup

> (http://www.saddi.com/projects/index.html) in prefork mode

> and have never had any serious issues.

>

> My experience of the mod_python approach was that we did

> encounter some problems related to threading and/or

> encapsulation (ie privacy between apps). In the flup prefork

> approach at least I believe the django wsgi server is running

> single threaded; also since we control the startup of the

> server as a normal user then only the flup socket needs to be

> writable by www.

> --

> Robin Becker

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at lists2.reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users

>



More information about the reportlab-users mailing list