[mod_python] This is just friggin' weird...

Joshua Ginsberg listspam at flowtheory.net
Thu Jun 23 18:33:39 EDT 2005

Hi Jim -- replies inline...
On Jun 23, 2005, at 3:01 PM, Jim Gallacher wrote:

> Nothing obvious comes to mind with the information, but I'll comment 
> anyway. :)
> Joshua Ginsberg wrote:
>> I have an application that I developed using PSP pages. It is seven 
>> steps to sign somebody up with our company. It worked just great 
>> yesterday, this morning, it hangs going from step 1 to step 2, but 
>> only with certain input data.
> Is it always the *same* data? What is different about that data?

Certain input data. What's different about the data is it fails certain 
error checking tests.

>> I have a development server for it that queries the same MySQL and 
>> MSSQL databases -- it hangs too at the same point. I inserted some 
>> debug output in the development server to see where it's hanging up.
> Not clear in the following where it is hanging. It either hangs at one 
> point or the other. Can't hang at 2 places at once, so which is it?

It hangs at the same point on both the development server and the 
production server.

>> When I don't have a Session defined, it hangs up at a section that is:
>> - a call to an API that inserts some data in a MySQL server
>> - a call to psp.redirect (which should throw an error because i've 
>> already returned stuff to the client, but it doesn't throw an error)
> Does psp.redirect get called or are you saying it hangs before it 
> reaches the redirect?. The beauty of python is you can jump right it 
> and change it. Stick a self.req.log_error() into the psp.redirect 
> method in psp.py and make sure it actually reaches that point if you 
> are in doubt.

I believe it is getting the the psp.redirect and hanging. As I said in 
my other post, it hangs at a different point when I enter form data 
that is bad in another way and a psp.redirect is being called.

>> Trying that API from command line by hand works like a charm, so I'm 
>> not convinced it's the API.
>> When I do have a Session defined, it hangs up on trying to import the 
>> session.
> Import the session or create the session? ie
> import Session
>    vs.
> sess = Session.DbmSession(req)

class BSISession(Session.DbmSession):
     def __getitem__(self, key):
             return super(BSISession, self).__getitem__(key)
         except KeyError:
             return ''

It hangs on:


The session is not new at this point, so it's reading it from the DBM 

> If you mean creating the session, it sounds like a deadlock issue. 
> There are known problems when using sessions in conjunction with psp 
> pages, where you create a session before calling a psp page which 
> contains a variable named 'session'. You'll need to manually save and 
> unlock the session before calling the psp run method.
> If you are on Windows there is a double whammy if you are trying to 
> use DbmSession in your handler code. The psp code will try to create a 
> new session instance but using MemorySession instead of DbmSession. 
> (It's not really Windows specific, it just that the default apache mpm 
> on Windows is threaded and so MemorySession is selected as the 
> default. And, it's is not actually a deadlock issue, but it will make 
> it appear like your session data is getting lost.)

Apache on Linux.

> These issues will be fixed in the soon to be released (we all hope) 
> version 3.2.
>> I've got a wrapper around the Session,DbmSession class which 
>> basically does nothing but return an empty string instead of raising 
>> an error if a key doesn't exist.
> So could this be masking some important information if an exception is 
> being raised?

My code is above... I think it's unlikely, but you tell me...

>> I've already cleared the dbm file, started over from scratch, and 
>> ensured that the dbm file is readable/writable by apache.
>> I cleared the semaphore array for Apache, I've restarted Apache, I've 
>> restarted MySQL, and none of it has helped...
>> Anybody have any ideas? I'm just stumped at this point. If you need 
>> code snippets or the site to test it out on, let me know. Thanks!
> Sorry I couldn't really help, but at least there a few more things for 
> you to think about.

I appreciate the feedback... but I'm afraid I'm still stuck... :-/


More information about the Mod_python mailing list