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

Jim Gallacher jg.lists at sympatico.ca
Thu Jun 23 17:01:11 EDT 2005


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?

> 
> 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?

> 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.

> 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)

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.)

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?

> 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.

Regards,
Jim



More information about the Mod_python mailing list