[mod_python] mod_python session trouble

Wouter van Marle wouter at squirrel-systems.com
Tue May 10 02:42:40 EDT 2005

On Tue, 2005-05-10 at 01:53 -0400, Graham Dumpleton wrote:
> It would help if you can isolate it to a very small example which
> demonstrates the problem and post it here.
See next mail.

> BTW, are you using req.internal_redirect() in any way, especially
> where you are trying to access the session object both before
> and after the redirection? Also, are you stashing any data within
> the "req" object for use in later phases of processing?
Not at all.

> Can possibly be related to unlocking of session not being done
> properly. Are you using "prefork" or a multithread MPM with Apache
> such as "worker"?
Euhm... my answer is "huh?" on this. Sorry I'm a real beginner in this.

I've used a stock install of Apache, checked basically only the paths,
and added configuration for mod_python. I'm at the moment not yet
interested so much in optimising apache.
When starting up, it starts in 5 sessions.


> There have been some issues with use of sessions and internal
> session locking code that have come up before, but at this stage
> couldn't be sure what is relevant and what isn't, so extra information
> including code example would help.
> Graham
> Wouter van Marle wrote ..
> > Hi all,
> > 
> > Recently I started experimenting with mod_python and the Session module.
> > I run into a very serious problem (tested in both Mozilla/Linux and
> > Safari/Mac), which appears to be a server side problem, in the
> > interaction of mod_python with Apache.
> > Description:
> > I open a session using sess=Session.Session(req).
> > When trying to load the same page (with session) again, it goes fine for
> > no more than about five times (sometimes not at all), and after that the
> > page hangs: waiting for response from server. I have noticed that there
> > are many new apache processes created, one for every attempted reload.
> > Restarting the server (service httpd restart) fixes the problem.
> > Switching off cookies in the browser also solves this problem, though it
> > of course also prevents session tracking and storage.
> > 
> > Software:
> > - Apache 2.0.50-5mdk (installed from Mandrake rpm)
> > - Python 2.3.4-6mdk
> > - mod_python 3.2.3 (rpm name: apache2-mod_python-2.0.50_3.1.3-1mdk)
> >
> > Anyone having the same problem? Any solutions?
> > Instead of sessions I've tried to use cookies, but info is only really
> > updated after the page is refreshed from the browser! I can set a cookie
> > and when re-reading it immediate after it is still the old info. So
> > that's also not a great solution.
> > 
> > Wouter.

More information about the Mod_python mailing list