[mod_python] psp.parsestring() hangs httpd

Jason Pratt jason at jasonpratt.org
Sun Dec 26 06:51:18 EST 2004

Hello.  I'm new to the list.

I'm experiencing a problem where calling psp.parsestring() will hang the 
httpd process every time it's called, with any string whatsoever.  I'm not 
using psp as a handler; I have my own custom handler and am simply calling 
psp.parsestring( myString ).  psp.parse( filename ), where filename is the 
path to a file containing the exact same text as myString, works 
perfectly.  After the hang, the httpd process that handled this request 
sits at about 30% cpu usage, and no appreciable memory gain.  It doesn't 
respond to SIGTERM.  I have to kill -9 it.

To be clear, this works:

def handler( req=None ):
         req.content_type = "text/html"
         file = open( "/tmp/test.psp", "w" )
         file.write( "Hello World" )
         exec psp.parse( "/tmp/test.psp" )
         return apache.OK

and this hangs:

def handler( req=None ):
         req.content_type = "text/html"
         exec psp.parsestring( "Hello World" )
         return apache.OK

I dug around in the code, and didn't see any obvious potential infinite 
loops.  I can only guess that something's going wrong in the scanner or parser.

Relevant system details:

Any ideas?

Jason Pratt
jason at jasonpratt.org

More information about the Mod_python mailing list