[mod_python] PSP and Session Probelms

Asif Jan asif.jan at epfl.ch
Wed Jun 1 13:41:29 EDT 2005


Hi Jim

I disabled the ldap but the problem persists ..... Here is the log

[Wed Jun 01 19:39:18 2005] [notice] mod_python: Creating 32 session  
mutexes based on 150 max processes and 0 max threads.
[Wed Jun 01 19:39:18 2005] [notice] Digest: generating secret for  
digest authentication ...
[Wed Jun 01 19:39:18 2005] [notice] Digest: done
[Wed Jun 01 19:39:19 2005] [notice] Apache/2.0.52 (Unix) DAV/2  
mod_python/3.1.4 Python/2.3 configured -- resuming normal operations
[Wed Jun 01 19:39:19 2005] [info] Server built: Sep 30 2004 18:20:43
[Wed Jun 01 19:39:19 2005] [debug] prefork.c(955): AcceptMutex: sysvsem  
(default: sysvsem)
[Wed Jun 01 19:39:53 2005] [error] [client 127.0.0.1] File does not  
exist: /Library/Apache2/htdocs/favicon.ico
[Wed Jun 01 19:39:55 2005] [error] [client 127.0.0.1] File does not  
exist: /Library/Apache2/htdocs/favicon.ico
[Wed Jun 01 19:39:58 2005] [notice] mod_python: (Re)importing module  
'mptest'
[Wed Jun 01 19:39:58 2005] [warn] (13)Permission denied: Failed to  
acquire global mutex lock at index 0
[Wed Jun 01 19:39:58 2005] [error] [client 127.0.0.1] PythonHandler  
mptest: Traceback (most recent call last):, referer:  
http://localhost/MODPYTHON/
[Wed Jun 01 19:39:58 2005] [error] [client 127.0.0.1] PythonHandler  
mptest:   File  
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/site-packages/mod_python/apache.py", line 299, in  
HandlerDispatch\n    result = object(req), referer:  
http://localhost/MODPYTHON/
[Wed Jun 01 19:39:58 2005] [error] [client 127.0.0.1] PythonHandler  
mptest:   File "/Library/Apache2/htdocs/MODPYTHON/mptest.py", line 5,  
in handler\n    _apache._global_lock(req.server, None, 0), referer:  
http://localhost/MODPYTHON/
[Wed Jun 01 19:39:58 2005] [error] [client 127.0.0.1] PythonHandler  
mptest: ValueError: Failed to acquire global mutex lock, referer:  
http://localhost/MODPYTHON/


Regards
Asif
On Jun 1, 2005, at 6:42 PM, Jim Gallacher wrote:

> Asif,
>
> I'm probably way out of my depth here, but could ldap be competing for  
> the mutexes as they are a limited system resource (on linux anyway)?
>
> If ldap is a loadable module, what happens if you disable it in the  
> apache config?
>
> Jim
>
> Asif Jan wrote:
>> Hi Jim
>> Here is the information;
>> [Wed Jun 01 18:12:39 2005] [notice] mod_python: Creating 32 session   
>> mutexes based on 150 max processes and 0 max threads.
>> [Wed Jun 01 18:12:40 2005] [notice] LDAP: Built with OpenLDAP LDAP SDK
>> [Wed Jun 01 18:12:40 2005] [notice] LDAP: SSL support unavailable
>> [Wed Jun 01 18:12:40 2005] [notice] Digest: generating secret for   
>> digest authentication ...
>> [Wed Jun 01 18:12:40 2005] [notice] Digest: done
>> [Wed Jun 01 18:12:40 2005] [debug] util_ldap.c(1432): INIT global  
>> mutex  /var/tmp/tmp.0.UjOapM in child 5476
>> [Wed Jun 01 18:12:40 2005] [debug] util_ldap.c(1432): INIT global  
>> mutex  /var/tmp/tmp.0.UjOapM in child 5477
>> [Wed Jun 01 18:12:40 2005] [debug] util_ldap.c(1432): INIT global  
>> mutex  /var/tmp/tmp.0.UjOapM in child 5478
>> [Wed Jun 01 18:12:40 2005] [debug] util_ldap.c(1432): INIT global  
>> mutex  /var/tmp/tmp.0.UjOapM in child 5479
>> [Wed Jun 01 18:12:40 2005] [debug] util_ldap.c(1432): INIT global  
>> mutex  /var/tmp/tmp.0.UjOapM in child 5480
>> [Wed Jun 01 18:12:40 2005] [notice] Apache/2.0.52 (Unix)   
>> mod_python/3.1.4 Python/2.3 DAV/2 configured -- resuming normal   
>> operations
>> [Wed Jun 01 18:12:40 2005] [info] Server built: Sep 30 2004 18:20:43
>> [Wed Jun 01 18:12:40 2005] [debug] prefork.c(955): AcceptMutex:  
>> sysvsem  (default: sysvsem)
>> Wed Jun 01 18:13:44 2005] [notice] mod_python: (Re)importing module   
>> 'mptest'
>> [Wed Jun 01 18:13:44 2005] [warn] (13)Permission denied: Failed to   
>> acquire global mutex lock at index 0
>> [Wed Jun 01 18:13:44 2005] [error] [client 127.0.0.1] PythonHandler   
>> mptest: Traceback (most recent call last):, referer:   
>> http://localhost/MODPYTHON/
>> [Wed Jun 01 18:13:44 2005] [error] [client 127.0.0.1] PythonHandler   
>> mptest:   File   
>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/  
>> python2.3/site-packages/mod_python/apache.py", line 299, in   
>> HandlerDispatch\n    result = object(req), referer:   
>> http://localhost/MODPYTHON/
>> [Wed Jun 01 18:13:44 2005] [error] [client 127.0.0.1] PythonHandler   
>> mptest:   File "/Library/Apache2/htdocs/MODPYTHON/mptest.py", line 5,  
>>  in handler\n    _apache._global_lock(req.server, None, 0), referer:   
>> http://localhost/MODPYTHON/
>> [Wed Jun 01 18:13:44 2005] [error] [client 127.0.0.1] PythonHandler   
>> mptest: ValueError: Failed to acquire global mutex lock, referer:   
>> http://localhost/MODPYTHON/
>> Regards
>> Asif
>> On Jun 1, 2005, at 5:39 PM, Jim Gallacher wrote:
>>> Hi Asif,
>>>
>>> Is there any indication in the apache error.log that the mutexes  
>>> where  created on apache startup? You should see something like:
>>>
>>> [Wed Jun 01 15:38:39 2005] [notice] mod_python: Creating 32 session   
>>> mutexes based on 6 max processes and 25 max threads.
>>> [Wed Jun 01 15:38:39 2005] [notice] Apache/2.0.54 (Debian GNU/Linux)  
>>>  mod_python/3.2.0-dev-20050519 Python/2.3.5 configured -- resuming   
>>> normal operations
>>>
>>> Jim
>>>
>>>
>>> Asif Jan wrote:
>>>
>>>> Hi Jim,
>>>> Here is the output from the log file   ( I saved the code in mptest  
>>>>   file)
>>>> [Wed Jun 01 17:23:15 2005] [notice] mod_python: (Re)importing  
>>>> module   'mptest'
>>>> [Wed Jun 01 17:23:15 2005] [warn] (13)Permission denied: Failed to   
>>>>  acquire global mutex lock at index 0
>>>> [Wed Jun 01 17:23:15 2005] [error] [client 127.0.0.1] PythonHandler  
>>>>   mptest: Traceback (most recent call last):, referer:    
>>>> http://localhost/MODPYTHON/
>>>> [Wed Jun 01 17:23:15 2005] [error] [client 127.0.0.1] PythonHandler  
>>>>   mptest:   File    
>>>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/   
>>>> python2.3/site-packages/mod_python/apache.py", line 299, in    
>>>> HandlerDispatch\n    result = object(req), referer:    
>>>> http://localhost/MODPYTHON/
>>>> [Wed Jun 01 17:23:15 2005] [error] [client 127.0.0.1] PythonHandler  
>>>>   mptest:   File "/Library/Apache2/htdocs/MODPYTHON/mptest.py",  
>>>> line 5,   in handler\n    _apache._global_lock(req.server, None,  
>>>> 0), referer:   http://localhost/MODPYTHON/
>>>> [Wed Jun 01 17:23:15 2005] [error] [client 127.0.0.1] PythonHandler  
>>>>   mptest: ValueError: Failed to acquire global mutex lock, referer:  
>>>>   http://localhost/MODPYTHON/
>>>> Regards
>>>> Asif
>>>> On Jun 1, 2005, at 5:02 PM, Jim Gallacher wrote:
>>>>
>>>>> Try restarting apache and run the following test handler:
>>>>>
>>>>> import _apache
>>>>>
>>>>> def handler(req):
>>>>>     req.content_type = 'text/plain'
>>>>>     req.write('begin lock test\n')
>>>>>     _apache._global_lock(req.server, None, 0)
>>>>>     _apache._global_unlock(req.server, None, 0)
>>>>>     req.write('begin lock test\n')
>>>>>     return apache.OK
>>>>>
>>>>> Check the apache error.log and post any errors (including apache    
>>>>> startup) regarding mutexes or locks.
>>>>>
>>>>> Regards,
>>>>> Jim
>>>>>
>>>>>
>>>>> Asif Jan wrote:
>>>>>
>>>>>> By the way I get same error when using the python scripts as well
>>>>>> Mod_python error: "PythonHandler mod_python.publisher"
>>>>>> Traceback (most recent call last):
>>>>>>   File     
>>>>>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/    
>>>>>> python2.3/site-packages/mod_python/apache.py", line 299, in     
>>>>>> HandlerDispatch
>>>>>>     result = object(req)
>>>>>>   File     
>>>>>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/    
>>>>>> python2.3/site-packages/mod_python/publisher.py", line 136, in    
>>>>>> handler
>>>>>>     result = util.apply_fs_data(object, req.form, req=req)
>>>>>>   File     
>>>>>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/    
>>>>>> python2.3/site-packages/mod_python/util.py", line 361, in    
>>>>>> apply_fs_data
>>>>>>     return object(**args)
>>>>>>   File "/Library/Apache2/htdocs/NEOBASE/mptest.py", line 5, in  
>>>>>> test
>>>>>>     sess = Session.Session(req)
>>>>>>   File     
>>>>>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/    
>>>>>> python2.3/site-packages/mod_python/Session.py", line 389, in   
>>>>>> Session
>>>>>>     timeout=timeout, lock=lock)
>>>>>>   File     
>>>>>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/    
>>>>>> python2.3/site-packages/mod_python/Session.py", line 294, in   
>>>>>> __init__
>>>>>>     timeout=timeout, lock=lock)
>>>>>>   File     
>>>>>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/    
>>>>>> python2.3/site-packages/mod_python/Session.py", line 131, in   
>>>>>> __init__
>>>>>>     self.lock()                 # lock new sid
>>>>>>   File     
>>>>>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/    
>>>>>> python2.3/site-packages/mod_python/Session.py", line 215, in lock
>>>>>>     _apache._global_lock(self._req.server, self._sid)
>>>>>> ValueError: Failed to acquire global mutex lock
>>>>>> On Jun 1, 2005, at 3:17 PM, Asif Jan wrote:
>>>>>>
>>>>>>>
>>>>>>> Hi ,
>>>>>>>
>>>>>>> When I try to use "session" object inside a PSP page I get   
>>>>>>> following   error  ( I am using Mac OS X 10.3.9 , Python 2.3   
>>>>>>> (Apple), and   mod_python 3.1.4).
>>>>>>>
>>>>>>> Is it something specific to Mac OS X ?
>>>>>>>
>>>>>>> By the way in my psp page I am doing a very simple thing i.e.
>>>>>>>
>>>>>>> if not session.is_new():
>>>>>>>     #  do something
>>>>>>> else:
>>>>>>>     # do something else
>>>>>>>
>>>>>>>
>>>>>>> Mod_python error: "PythonHandler mod_python.psp"
>>>>>>>
>>>>>>> Traceback (most recent call last):
>>>>>>>
>>>>>>>   File     
>>>>>>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/    
>>>>>>> python2.3/site-packages/mod_python/apache.py", line 299, in     
>>>>>>> HandlerDispatch
>>>>>>>     result = object(req)
>>>>>>>
>>>>>>>   File     
>>>>>>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/    
>>>>>>> python2.3/site-packages/mod_python/psp.py", line 297, in handler
>>>>>>>     p.run()
>>>>>>>
>>>>>>>   File     
>>>>>>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/    
>>>>>>> python2.3/site-packages/mod_python/psp.py", line 191, in run
>>>>>>>     session = Session.Session(req)
>>>>>>>
>>>>>>>   File     
>>>>>>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/    
>>>>>>> python2.3/site-packages/mod_python/Session.py", line 389, in   
>>>>>>> Session
>>>>>>>     timeout=timeout, lock=lock)
>>>>>>>
>>>>>>>   File     
>>>>>>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/    
>>>>>>> python2.3/site-packages/mod_python/Session.py", line 294, in    
>>>>>>> __init__
>>>>>>>     timeout=timeout, lock=lock)
>>>>>>>
>>>>>>>   File     
>>>>>>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/    
>>>>>>> python2.3/site-packages/mod_python/Session.py", line 131, in    
>>>>>>> __init__
>>>>>>>     self.lock()                 # lock new sid
>>>>>>>
>>>>>>>   File     
>>>>>>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/    
>>>>>>> python2.3/site-packages/mod_python/Session.py", line 215, in  
>>>>>>> lock
>>>>>>>     _apache._global_lock(self._req.server, self._sid)
>>>>>>>
>>>>>>> ValueError: Failed to acquire global mutex lock
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Mod_python mailing list
>>>>>>> Mod_python at modpython.org
>>>>>>> http://mailman.modpython.org/mailman/listinfo/mod_python
>>>>>>>
>>>>>>>
>>>>>> Asif Jan
>>>>>> Research Assistant
>>>>>> Brain Mind Institute
>>>>>> Ecole Polytechnique Federale De Lausanne (EPFL)
>>>>>> Lausanne Switzerland
>>>>>> Tel +41216939529
>>>>>> _______________________________________________
>>>>>> Mod_python mailing list
>>>>>> Mod_python at modpython.org
>>>>>> http://mailman.modpython.org/mailman/listinfo/mod_python
>>>>>
>>>>>
>>>>>
>>>>>
>>>> Asif Jan
>>>> Research Assistant
>>>> Brain Mind Institute
>>>> Ecole Polytechnique Federale De Lausanne (EPFL)
>>>> Lausanne Switzerland
>>>> Tel +41216939529
>>>> _______________________________________________
>>>> Mod_python mailing list
>>>> Mod_python at modpython.org
>>>> http://mailman.modpython.org/mailman/listinfo/mod_python
>>>
>>>
>>>
>> Asif Jan
>> Research Assistant
>> Brain Mind Institute
>> Ecole Polytechnique Federale De Lausanne (EPFL)
>> Lausanne Switzerland
>> Tel +41216939529
>> _______________________________________________
>> Mod_python mailing list
>> Mod_python at modpython.org
>> http://mailman.modpython.org/mailman/listinfo/mod_python
>
>
Asif Jan
Research Assistant
Brain Mind Institute
Ecole Polytechnique Federale De Lausanne (EPFL)
Lausanne Switzerland

Tel +41216939529



More information about the Mod_python mailing list