[mod_python] RE: Apache on Windows and concurrency

Iain Mackay imm at iain-mackay.org
Tue Jul 6 20:00:36 EDT 2004


Hi all
I'm finding mod_python to be a very powerful tool. I have an application in
mind that is rather similar to some work I noticed in this list the other
day, i.e. using mod_python to provide sophisticated authentication for
WebDAV access to a repository.
One issue that has troubled me today is that it seems the observation that
one process=one interpreter, and therefore database connections (or other
data) may be shared in global variables, does not work for a default Apache
Windows configuration.
I may have missed something in the documentation but it seems essential that
Apache should have ThreadsPerChild=1, or you find multiple instances of your
handlers running concurrently, creating havoc with your shared updateable
variables.
I found a discussion of this problem on the web a few years back, but
nothing relating to current Apache and mod_python.
I don't think there is a way to, perhaps, query the server configuration to
at least detect a multi-threaded context.
I'm a little surprised that the Python interpreter itself doesn't suffer
catastrophic failures if it is called by Apache from multiple threads. So
maybe mod_python is ensuring there is one Python thread per process thread?
And if so, is there any way an application can interact with that, and maybe
have threads of its own to synchronize access to global resources?
Thanks for your consideration of these remarks
Iain





More information about the Mod_python mailing list