[mod_python] mod_python crashes Apache under Windows XP

Patrick Fitzsimmons patfitz at gmail.com
Mon Jun 27 02:56:55 EDT 2005


I am running mod_python 3.1 under Apache and Windows XP.  I
am building a database driven web site using Python Server Pages and a
MySQL back end (using the ADOdb module).  The site is up and working
fine.  My problem is that when I try and do a primitive load test by
reloading the pages very, very quickly, two critical bugs appear.

The first problem is that sometimes the req.uri mysteriously changes
from "/home.html" to "other.html"

Here's the source code in my handler script:

from mod_python import apache, psp, Session, util
##import wingdbstub
import sys
import os
import traceback
import time
import initModule

def handler(req):
    #Standard out should print to the browser for debugging
    oldstdout = sys.stdout
    sys.stdout = req

    print req.uri       # Here req.uri always prints out "/home.html",
even when reloading quickly
    print "1"
    init = initModule.InitClass()
    init.req = req
    print init.req.uri   # Here req.uri also prints out "/home.html"
until I start reloading too quickly.  Then it prints out "/other.html"

What's going on here?  Are somehow the two requests trying to access
the same object?  But why does it say "/other.html"?  From what I can
tell, the word other.html is not used a single time in any of my
scripts nor does other.html exist as a file.  I've gotten the same
problem in both Firefox and IE.  I never have any problems running PHP

The second problem is that sometimes the request just hangs, and then
Windows gives me a message saying "Apache.exe encountered a critical
error and was forced to shut down"

I thought that some kind of threading problems might be the issue. 
I've looked through all my modules though, and from what I can tell
not once do I modify module variables  (I only read the variables and
call functions).  Also, for the database connection I am using a pool,
whereby new connections are created if existing ones are being used. 
I do have PHP installed in the same Apache, but it's not being
actively used.

I also edited the Apache conf file and set MaxRequestPerChild to 1,
but that did not solve the problem either.

Has anyone else had these problems? Can anyone help me?  I'm going to
try uploading the site to my Linux Virtual Private Server (I'm only
running mod_python on XP so that I can do development on my laptop). 
Hopefully this problem is just a Windows issue.  Otherwise I don't see
how I can use mod_python.

Help greatly appreciated,

More information about the Mod_python mailing list