[reportlab-users] Intermittent failure to find font, followed by IOError
Stevens, Ian
IStevens at globeandmail.com
Wed Nov 4 19:18:09 EST 2009
> > We are using the same codebase for several different domain
> > names. I suppose it is possible that some objects are being shared across
> > domains, and subsequently over interpreters as well. It might be a
Right, so here's what I've done so far:
I set up two Apache virtual hosts using different ServerNames. Starting with apache-mpm-worker (as on production), I hit random URLs, 50% with one ServerName, 50% with the other. The error appeared, along with some previously-unseen KeyErrors when changing fonts. (Those are probably the result of the _reset which I added when I assumed production was running prefork.)
The errors ceased when I switched to prefork, changing nothing else. This was odd as changing to prefork on production would cause the errors to become more frequent. I then turned on caching to see if sharing objects between interpreters would (somehow) cause the error to appear. Still nothing. Very odd, but as expected.
Switching back to apache-mpm-worker, I changed my sites to use the same PythonInterpreter (see http://www.modpython.org/live/current/doc-html/dir-other-pi.html). As would be expected, the errors increased dramatically, probably because of the combination of fewer interpreters, and _reset being called in a multi-threaded environment.
Using the same PythonInterpreter and apache-mpm-prefork had no negative effect.
I'm still uncertain as to why our production environment raises more IOErrors for fonts under prefork than worker, and why I can't replicate it using this technique. It's positive that I was able to replicate the error with the knowledge that each ServerName setting results in a different PythonInterpreter.
Ian.
More information about the reportlab-users
mailing list