[mod_python] Udate python modules without restarting Apache

Graham Dumpleton grahamd at dscpl.com.au
Sat Oct 9 19:42:40 EDT 2004

On 09/10/2004, at 6:10 PM, Nicolas Lehuen wrote:

> Hi Graham, what are the pros and cons of using the imp module versus an
> execfile call or an exec call ?
> Using Apache 2.0.52 on win32, with a multithreaded MPM, I have noticed 
> a few
> problem with mod_python.publisher which reloads the same module many 
> times
> when many threads try to load it concurrently. It seems that either
> mod_python.publisher or the imp module does not properly handle this
> situation. The result is that I have many instances of the same module 
> in
> memory, so I got many connection pools instead of only one and so on. 
> That's
> why I decided to fix this and other problems (the famous 'only one 
> index.py
> in your application') by reimplementing my own variant of the 
> publisher.

You have asked me about the one thing that I can't yet comment on. That 
is, how
threading affects all this. Reason is that I don't have access to a 
copy of
Apache which runs with threads to try things out. Not sure if I can 
Apache on Mac OS X to use threading or not.

To look at the whole threading issue was one of the next things to do 
on my
list. I need to go back through previous posts on the mailing list to 
see what
has been said before, see what the documentation says and also troll 
the source code.

The threading stuff worries me enough to say that only "prefork" should 
used with the Vampire package I make available. There is currently 
in the code to protect against multithread access to critical bits, so 
bound to
fail at some point.

Graham Dumpleton (grahamd at dscpl.com.au)

More information about the Mod_python mailing list