[mod_python] mod_python session trouble

Graham Dumpleton grahamd at dscpl.com.au
Tue May 10 01:53:44 EDT 2005

It would help if you can isolate it to a very small example which
demonstrates the problem and post it here.

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?

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

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.


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