Jim Gallacher
jg.lists at sympatico.ca
Tue May 10 02:01:32 EDT 2005
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. Hi Wouter, This looks like a problem with session locking, which is the default when creating a session. Are you creating more than one session object in a request? If so you'll end up with a deadlock. For example the following code will deadlock as it is really just accessing the same session data: sess1 = Session.Session(req) sess2 - Session.Session(req) Note that if you reference a session object in both your handler code and in a psp page, the psp publisher will also try to create a new session object resulting in a deadlock in a similar fashion. Once a session is deadlocked, the process handling that request is blocked and is unavailable to handle additional requests, which is why you see the number of apache processes increasing. Eventually you'll hit the limit and apache will stop responding until you restart, which releases the locks being held. There are very good reasons for session locking, but it is not well documented. (I'm actually working on expanding the documentation for sessions which should help). Perhaps you could elaborate a little on how you are using sesisons? Regards, Jim
|