[mod_python] ValueError: Failed to acquire global mutex lock

Graham Dumpleton graham.dumpleton at gmail.com
Tue Oct 23 07:35:32 EDT 2007


What operating system are you on? Does that system run SELinux extensions?

Bar starting to disable other Apache modules to see if there is a
conflict, or doing a complete clean of Apache source and recompiling
everything, include other third party modules, not sure what else to
suggest.

Graham

On 23/10/2007, Michael Robokoff <mike.robokoff at apioutsourcing.com> wrote:
> [Thu Oct 18 07:37:38 2007] [notice] mod_python: Creating 8 session mutexes
> based on 6 max processes and 25 max threads.
> [Thu Oct 18 07:37:38 2007] [notice] mod_python: using mutex_directory /tmp
> [Thu Oct 18 07:37:38 2007] [notice] Apache/2.0.59 (Unix) DAV/2 mod_jk/1.2.23
> mod_python/3.3.1 Python/2.5.1 configured -- resuming normal operations
> [Thu Oct 18 07:37:38 2007] [info] Server built: Oct 11 2007 13:49:08
> [Thu Oct 18 07:37:38 2007] [debug] worker.c(1676): AcceptMutex: fcntl
> (default: fcntl)
>
> So I tried "AcceptMutex flock"
>
> And I got this:
>
> Syntax error on line 165 of /usr/local/apache2/conf/httpd.conf:
> flock is an invalid mutex mechanism; Valid accept mutexes for this platform
> and MPM are: default, fcntl, sysvsem, posixsem, pthread.
>
> I also tried all of the lock mechanisms available. (fcntl, sysvsem,
> posixsem, pthread) nothing changed with the use of the different
> locking mechanisms
>
> Here is my apr.h info:
>
> #define APR_USE_FLOCK_SERIALIZE           0
> #define APR_USE_SYSVSEM_SERIALIZE         0
> #define APR_USE_POSIXSEM_SERIALIZE        0
> #define APR_USE_FCNTL_SERIALIZE           1
> #define APR_USE_PROC_PTHREAD_SERIALIZE    0
> #define APR_USE_PTHREAD_SERIALIZE         1
>
> #define APR_HAS_FLOCK_SERIALIZE           0
> #define APR_HAS_SYSVSEM_SERIALIZE         1
> #define APR_HAS_POSIXSEM_SERIALIZE        1
> #define APR_HAS_FCNTL_SERIALIZE           1
> #define APR_HAS_PROC_PTHREAD_SERIALIZE    1
> #define APR_PROCESS_LOCK_IS_GLOBAL        0
>
> Does this help at all?
> Is there anything else I can look at or try?
>
>
> Graham, Thanks so much for your help. I really really appreciate it
>
> --Mike
>
> -----Original Message-----
> From: Graham Dumpleton [mailto:graham.dumpleton at gmail.com]
> Sent: Wednesday, October 17, 2007 5:23 PM
> To: Michael Robokoff
> Cc: mod_python
> Subject: Re: [mod_python] ValueError: Failed to acquire global mutex lock
>
> On 17/10/2007, Michael Robokoff <mike.robokoff at apioutsourcing.com> wrote:
> > Graham, Thanks so much for your help, unfortunately I don't think it
> > made any difference. I don't see any real change in error messages.
> > Should I check on how to increase the semaphores at the system level?
>
> What do the messages in the Apache error log indicate about how many
> mutexes mod_python is actually using? The directive must be in the
> correct context else it is ignored.
>
> > [Tue Oct 16 06:36:49 2007] [warn] (45)Deadlock situation detected/avoided:
> > Failed to acquire global mutex lock at index 2
>
> This error message possibly indicates the problem as being due to
> something else.
>
> One suggestion is to set the Apache configuration directive AcceptMutex.
>
>   http://httpd.apache.org/docs/2.2/mod/mpm_common.html#acceptmutex
>
> Set it to:
>
>   AcceptMutex flock
>
> This may not change the lock type used by mod_python though because of
> it how it wrongly indicates which type of lock to use:
>
>   https://issues.apache.org/jira/browse/MODPYTHON-202
>
> It may release more semaphores though for use.
>
> BTW, in apr.h in Apache include directory, what are the following set
> to for your system.
>
> #define APR_USE_FLOCK_SERIALIZE           0
> #define APR_USE_SYSVSEM_SERIALIZE         1
> #define APR_USE_POSIXSEM_SERIALIZE        0
> #define APR_USE_FCNTL_SERIALIZE           0
> #define APR_USE_PROC_PTHREAD_SERIALIZE    0
> #define APR_USE_PTHREAD_SERIALIZE         1
>
> #define APR_HAS_FLOCK_SERIALIZE           1
> #define APR_HAS_SYSVSEM_SERIALIZE         1
> #define APR_HAS_POSIXSEM_SERIALIZE        1
> #define APR_HAS_FCNTL_SERIALIZE           1
> #define APR_HAS_PROC_PTHREAD_SERIALIZE    0
>
> Graham
>
> > --Mike
> >
> >
> > -----Original Message-----
> > From: Graham Dumpleton [mailto:graham.dumpleton at gmail.com]
> > Sent: Tuesday, October 16, 2007 7:29 AM
> > To: Michael Robokoff
> > Cc: mod_python
> > Subject: Re: [mod_python] ValueError: Failed to acquire global mutex lock
> >
> > Your system has a low number of sysvsem's configured and it is running
> > out. Whether you use prefork or worker shouldn't matter. You can
> > change the number that mod_python uses, setting it to a lower value
> > using the directive:
> >
> >   PythonOption mod_python.mutex_locks 4
> >
> > Must be defined at global scope in Apache configuration. Check Apache
> > error logs to see if it works.
> >
> > Note, you must be using mod_python 3.3.1.
> >
> > Graham
> >
> > On 16/10/2007, Michael Robokoff <mike.robokoff at apioutsourcing.com> wrote:
> > >
> > >
> > >
> > >
> > > Hello,
> > >
> > > I just changed from running apache configured with "mpm=prefork" to
> > > "mpm=worker".
> > >
> > > Everything worked with the "prefork" attribute. We decided to change
> over
> > to
> > > multi threading
> > >
> > > to test performance, so I recompiled apache with the "worker" attribute.
> > Now
> > > we get the error
> > >
> > >
> > >
> > > [error] [client]   File
> > > "/usr/local/lib/python2.5/site-packages/mod_python/Session.py",
> > > line 280, in lock\n
> > > _apache._global_lock(self._req.server, self._sid), referer:
> > > http://......
> > >
> > >
> > >
> > > "ValueError: Failed to acquire global mutex lock" referer: http:...
> > >
> > >
> > >
> > > Can you please give me some direction on this.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Michael Robokoff
> > >
> > > Senior Systems Administrator
> > >
> > > API Outsourcing
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > 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