[mod_python] session locking causes hang with mpservlets

Graham Dumpleton grahamd at dscpl.com.au
Sat Mar 26 17:01:52 EST 2005


Try adding:

   self.session.unlock()

just before the internal redirect and see what happens.

I don't believe this should be required as mpservlets is using
its own internal redirect which actually saves the session before
doing the real internal redirect.

Anyway, this "experiment" might at least help you to understand
things better.

BTW, I am assuming when you say "make session lock=0", you mean
setting "use_session" appropriately. Is that correct?

Graham

On 27/03/2005, at 7:29 AM, Scott Chapman wrote:

> Using linux - prefork mpm.
> I set my httpd.conf:
> StartServers 1
> MinSpareServers 1
> MaxSpareServers 0
> MaxClients 1
> MaxRequestsPerChild  0
>
> for this test run.
>
> Here's my UberServlet:
> -------------- snip --------------
> from mod_python.servlet import Servlet
>
> class uberservlet(Servlet):
>     use_session = True
>
>     def respond(self):
>         self.req.log_error('Responding')
> methodName=self.req.uri[:len(self.req.uri)-len(self.req.path_info)][1:]
>         self.req.log_error('methodName: '+methodName)
>         if methodName == 'index':
>             self.req.log_error('Redirecting to login')
>             self.internal_redirect('/login')
>         if methodName == 'login':
>             self.req.log_error('Doing login')
>             self.writeln ('<h1>login_here</h1>')
>             return True
>
>     def wrapup(self):
>         Servlet.wrapup(self)
> -------------- snip --------------
> When I make Sesssion lock=0, it doesn't hang.
> When I don't set lock = 0 (the default) it hangs when trying to 
> establish the session:
>   self.session = Session.Session(self.req, 
> timeout=self.session_timeout)
>
> What problems do I look forward to if I run with lock=0?
>
> Quoting Grisha:
> "One thing you may try as an experiment is to disable session locking
> (Session(lock=0)). It will still use locking for access to the DBM, 
> but it won't lock individual sessions."
>
> Grisha calls this "an experiment".  Can anyone tell me why locking is 
> failing and what will happen if I run with locking off?
>
> TIA,
> Scott
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list