[mod_python] session locking causes hang with mpservlets

Scott Chapman scottie at mischko.com
Sat Mar 26 16:29:25 EST 2005


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


More information about the Mod_python mailing list