[mod_python] Any support for on-time Initialization?

perry.tew at cibavision.novartis.com perry.tew at cibavision.novartis.com
Mon Feb 2 22:44:33 EST 2004

   Alas, I fear I have offended.  Let me elaborate on the errors I 
received.  While using the worker MPM, I was making calls to an oracle 
database using cx_Oracle (bad idea) and later the DCOracle2 
implementation.  Under low stress, the worker MPM contained no errors. 
However, under heavy load, I started to receive errors thrown from the 
jonpy dbpool.py class, specifically in the _connection_notinuse method. It 
would recurse until the apache child died.    When I switched to the 
prefork model I could not reproduce the error at all.  And I pounded the 
site using ab and 250 clients. 
    Without knowing for sure that the jonpy module was absolutely correct, 
it is unfair for me to say that it's mod_python's fault.  However, it is 
fair for me to say that the combination of mod_python with the jon.dbpool 
class did not work under the worker MPM, and does work under the prefork.  
I could not and do not know how to validate the dbpool.py class.  I'm new 
to python and have yet to understand weak references and some other 
things.  It was easy for me to recompile apache using a different MPM.   I 
hope that sheds some more light onto the situation I'm encountered and 
gives mod_python a fairer shake.

    Let me also say that I feel really bad speaking negatively about free 
open source software.  I know you've worked hard for the past several 
years to provide a really good python module for apache.  I do appreciate 
it.   I also know that since I've paid zero dollars to use it, it's bad 
mojo to criticize.  However, I was only trying to help another developer 
having similar issues as I was.

    I do intend to contribute to this project. But, I come from a strong 
java background and am learning python and C as I go.  Man, do I _love_ 
python.  Right now I am but a grasshopper.   I will commit to 
troubleshooting the jonpy module under the worker MPM and report back what 
the root cause failure analysis is (as best as I understand it).   I did 
not do it previously because of deadlines (I know we all got 'em).  When I 
can, I will investigate.      It would help if anyone has any experience 
with the jonpy modules and can report on their experiences.  It would also 
help if someone could suggest another pooling module to manage db 
connections under a threaded model.  I don't know of another.

    In the meantime, is there anything I can do from a low-tech or 
non-tech perspective that doesn't require a critical timeline?

Perry Tew

At 09:41 PM 2/2/2004 -0500, you wrote:

>On Mon, 2 Feb 2004, Daniel West wrote:
> > At 02:33 PM 2/2/2004 -0500, you wrote:
> >
> > >Like Daniel said, going with a threaded MPM is not for the faint of
> > >heart, as MySQLdb doesn't like sharing connections very much.
> >
> > Actually, database connections can successfully be shared among 
> > threads with the standard Python Queue module plus some support
> > code.  However, mod_python seems to have problems in general with
> > multi-threaded environments.
>Just to be fair - mod_python does not have problems with multi-threaded
>environments, none that I am aware of at least. It is used quite a bit in
>mutlithreaded environments, not the least of which is Windows, where
>multi-threaded is the only option.
>What does have a problem with multi-threaded environment is one of the
>commonly used MySQL Python modules, which doesn't really have much to do
>with mod_python itself.


I posted a problem I ran into a couple weeks ago to this list (subject: 
3.1.2b and worker_mpm).  Seems the output filter under load was mixing up 
requests.  When making a request I would get part of my request plus part 
of another request.  When I changed to a prefork model, that problem went 
away.  The only response I got to my message was from Perry who claims "it 

went to pieces under stress testing" and "I saw some
wicked nasty recursion errors" in reference to the worker_mpm and 
mod_python.  Since I didn't get any response from you or anyone else in 
know about these things, I was left to assume that this was a weak area 
mod_python which would receive attention in due time.  I even offered my 
assistance for testing.  I don't know how else to describe the problem I 
experienced except for a threading issue.

Perhaps there's something there that you're not aware of.  I, for one, 
would love to be able to use worker_mpm again.


Mod_python mailing list
Mod_python at modpython.org

More information about the Mod_python mailing list