[mod_python] PSP and Session Probelms

Jim Gallacher jg.lists at sympatico.ca
Wed Jun 1 11:39:45 EDT 2005


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
> 



More information about the Mod_python mailing list