[mod_python] All spawned threads in Restricted Exection Mode

Graham Dumpleton grahamd at dscpl.com.au
Wed Mar 30 18:28:26 EST 2005


Alan Davies wrote ..
> Hi,
> 
> I've seen some comments on this problem in the past, and was wondering
> if a fix/workaround has ever emerged.
> 
> It seems that when I spawn a thread in mod_python, the thread runs in
> Restricted Execution Mode. I get errors like this when I try to do
> simple things such as import Python Image Library's 'Image' module:
> 
>     RuntimeError: cannot unmarshal code objects in restricted execution
>     mode
> 
> The same code running in the main thread works fine. I've tried python
> versions 2.2 and 2.3, and just tried installing the latest versions I
> could find: Apache/2.0.53 (Win32) mod_python/3.1.4 Python/2.4 - problem
> is still there. A few months ago I had this code up and running on
> this same machine, probably with Python 2.3.
> 
> Another machine with this configuration has no problem: Apache/2.0.52
> (Win32) mod_python/3.1.3 Python/2.3.2
> 
> This is a very annoying problem; the ability to have a thread running
> that persists across and interacts with http requests is my reason for
> using mod_python, any ideas how I can solve this?

The only self contained purported examples of the problem worked for
other people and thus weren't useful in helping to track down any problem.

In the main it always seems to involve third party packages which are
non trivial or may be hard to install which makes it a harder process for
someone else to try and duplicate it. PIL as a third party package doesn't
have strange runtime requirements such as a database needing to be
created, so try and get as small an example as possible put together
and post here on the list and I at least can try it and see if I see the
problem. I would be testing it on Mac OS X, Apache 2.X and Python 2.3.

In the multithreaded stuff I am doing at the moment, I personally don't
have problems and mine is probably a stranger arrangement than most. :-)

Graham


More information about the Mod_python mailing list