[mod_python] Session unable to acquire mutex lock?

Russell Lear RussLear314 at yahoo.com
Mon Dec 29 08:57:00 EST 2003


Grisha,

Thanks for the suggestions.  

I did a stop/start and the problem happens on the first hit.

I enabled some debug logging (See below).  

There are two things I notice that seem odd to my inexperienced eye: 

1) During apache's startup, mod_python says
    "Creating 32 session mutexes based on 150 max processes and 0 max threads".  
Is "0 max threads" correct, or do I have something misconfigured? 
Seems like max threads ought to be at least 1 or 2 ??

2) When I invoke my test, there is a warning
    "Permission denied: Failed to acquire global mutex lock at index 17".  
Is that just saying that it failed to get a mutex lock or do I have bad permissions someplace?

Thanks,
Russell.

====================
Apache error_log exerpt:
[... 08:30:57 ] [info] Server: Apache/2.0.48, Interface: mod_ssl/2.0.48, Library: OpenSSL/0.9.7b
[... 08:30:57 ] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec2)
[... 08:31:00 ] [info] Init: Initializing OpenSSL library
[... 08:31:00 ] [info] Init: Seeding PRNG with 0 bytes of entropy
[... 08:31:00 ] [info] Init: Generating temporary RSA private keys (512/1024 bits)
[... 08:31:00 ] [info] Init: Generating temporary DH parameters (512/1024 bits)
[... 08:31:00 ] [info] Init: Initializing (virtual) servers for SSL
[... 08:31:00 ] [info] Server: Apache/2.0.48, Interface: mod_ssl/2.0.48, Library: OpenSSL/0.9.7b
[... 08:31:02 ] [notice] mod_python: Creating 32 session mutexes based on 150 max processes and 0 max threads.
[... 08:31:02 ] [notice] Apache/2.0.48 (Linux/SuSE) mod_ssl/2.0.48 OpenSSL/0.9.7b PHP/4.3.3 mod_python/3.1.2b Python/2.3+ configured -- resuming normal operations
[... 08:31:02 ] [info] Server built: Nov 10 2003 11:47:10
[... 08:31:02 ] [debug] prefork.c(1037): AcceptMutex: sysvsem (default: sysvsem)
[... 08:31:15 ] [notice] mod_python: (Re)importing module 'mptest'
[... 08:31:16 ] [warn] (13)Permission denied: Failed to acquire global mutex lock at index 17
[... 08:31:16 ] [error] [client ::1] PythonHandler mptest: Traceback (most recent call last):
[... 08:31:16 ] [error] [client ::1] PythonHandler mptest: 
    File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 338, in HandlerDispatch
    result = object(req)
[... 08:31:16 ] [error] [client ::1] PythonHandler mptest:
    File "/srv/www/htdocs/test/mptest.py", line 7, in handler
    sess = Session.Session(req)
[... 08:31:16 ] [error] [client ::1] PythonHandler mptest:
    File "/usr/lib/python2.3/site-packages/mod_python/Session.py", line 411, in Session
    timeout=timeout)
[... 08:31:16 ] [error] [client ::1] PythonHandler mptest:
    File "/usr/lib/python2.3/site-packages/mod_python/Session.py", line 316, in __init__
    secret=secret, timeout=timeout)
[... 08:31:16 ] [error] [client ::1] PythonHandler mptest:   
    File "/usr/lib/python2.3/site-packages/mod_python/Session.py", line 170, in __init__
    self.lock()                 # lock new sid
[... 08:31:16 ] [error] [client ::1] PythonHandler mptest:   
    File "/usr/lib/python2.3/site-packages/mod_python/Session.py", line 241, in lock
    _apache._global_lock(self._req.server, self._sid)
[... 08:31:16 ] [error] [client ::1] PythonHandler mptest: 
    ValueError: Failed to acquire global mutex lock

====================

On Sunday 28 December 2003 10:28, Gregory (Grisha) Trubetskoy wrote:
> If you restart the server, and try this code, does the error happen on the
> first hit, or only starting with the second and after waiting for a while?
>
> If if it's the former, then there probably is some problem with locking in
> general (are there any warning messages on server startup?). ...
>
> Grisha
>
> On Sat, 27 Dec 2003, Russell Lear wrote:
> > Hi,
> >
> > [RLear: 2003/12/29: deleted text to avoid overly long attachment]
> >
> >     from mod_python import apache, Session
> >     import sys
> >
> >     def handler(req):
> >         req.content_type = 'text/plain'
> >         req.write("Creating...\n")
> >         sess = Session.Session(req)
> >         req.write("Hello World!")
> >         return apache.OK
> >
> >  [RLear: 2003/12/29: deleted text to avoid overly long attachment]
> >
> > I'm running on SuSE 9.0 Linux.
> >
> > Python reports version "Python 2.3+ (#1, Sep 23 2003, 23:07:16)".
> >
> > >From the Apache error page:
> >
> >     Apache/2.0.48 (Linux/SuSE),
> >     mod_python/3.1.2b
> >     Python/2.3+.
> >
> > The only glitch I had in building mod_python was that I needed to specify
> >     ./configure --with-apxs=/usr/sbin/apxs2
> >
> > rather than just refering to apxs.
> >
> > My apache configuration is (from the tutorial):
> > <Directory /srv/www/htdocs/test>
> >   AddHandler python-program .py
> >   PythonHandler mptest
> >   PythonDebug On
> > </Directory>
> >
> >
> >
> > _______________________________________________
> > 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