[mod_python] Thread stopping and asynchronous calls

Graham Dumpleton graham.dumpleton at gmail.com
Fri Nov 16 16:51:01 EST 2007


Huh, are you saying that you are creating a listener socket in the
Apache child process from mod_python. You can't really do this as
Apache is a multi processor web server and you cant have multiple
processes creating a listener socket on the same port. Thus all but
the first Apache child process would fail. When that process gets
recycled by Apache, none of the other Apache child processes would
take over and thus no listener anymore.

Graham

On 17/11/2007, Chris Guin <cguin at bbn.com> wrote:
> I've been working on a custom chat server for Django (using
> mod_python), but have been hugely frustrated with the behavior of my
> "listening thread."  The thread stops at either the time.sleep() or
> select.select() call and never returns - usually when a lot of
> asynchronous requests are being answered by the server, although not
> always (even with one or two browsers left running over night, the
> thread will eventually stop).  Increasing the frequency of the async
> requests or increasing the number of browsers raises the chance of
> stoppage to near certain levels - but there's still a high random factor to it.
>
> I have guaranteed that there is only one "listening thread" running
> at any time, and have commented out all database and network accesses
> (so my listening thread is just printing out debug statements and
> calling time.sleep() and my AJAX calls only retrieve random
> numbers).  The problem still occurs, and in the same manner.  Nor is
> it a gradual slowdown - time.sleep() takes the correct number of
> seconds to return right up until the time it fails to return at all.
>
> When Apache starts up it says: "mod_python: Creating 8 session
> mutexes based on 256 max processes and 0 max threads."  This looks a
> little suspicious - is there a mod_python setting that I have
> incorrect?  My understanding of the workings of mod_python is fairly
> weak, so this may not even the right group to be posting to.
>
> Thanks for any help you could give,
> Chris Guin
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list