[mod_python] session problems on mac os x

Jim Gallacher jpg at jgassociates.ca
Sun Nov 5 08:09:19 EST 2006


Papanii Okai wrote:
> Hi Guys,
>             i seem to have a problem with sessions i cannot seem to get 
> my head around.  I am using the publisher as my dispatcher. When a 
> person logs in i have a method  that creates the sessions. Below is the 
> code..
> 
> def sessionCreation(req, id):
>    packSession = Session.Session(req)
>    packSession['userID'] = id
>    packSession.save()
> 
> Now, when a page is requested i have another handler that does some 
> stuff.. below is a stripped down version...
> 
> 
> def getMain(req):
>     packSession = Session.Session(req)
>     req.write("cool")
> 
> For some reason i am getting the following error when this handler is 
> executed...
> ------------------------------------------------------------------------------------------------------- 
> 
> Mod_python error: "PythonHandler mod_python.publisher"
> 
> Traceback (most recent call last):
> 
>  File 
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/apache.py", 
> line 299, in HandlerDispatch
>    result = object(req)
> 
>  File 
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/publisher.py", 
> line 213, in handler
>    published = publish_object(req, object)
> 
>  File 
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/publisher.py", 
> line 412, in publish_object
>    return publish_object(req,util.apply_fs_data(object, req.form, req=req))
> 
>  File 
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/util.py", 
> line 439, in apply_fs_data
>    return object(**args)
> 
>  File "/Users/papaniiokai/Sites/citepack/citepack.py", line 35, in login
>    sessionCreation(req, success)
> 
>  File "/Users/papaniiokai/Sites/citepack/citepack.py", line 79, in 
> sessionCreation
>    packSession = Session.Session(req)
> 
>  File 
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/Session.py", 
> line 735, in Session
>    timeout=timeout, lock=lock)
> 
>  File 
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/Session.py", 
> line 337, in __init__
>    timeout=timeout, lock=lock)
> 
>  File 
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/Session.py", 
> line 173, in __init__
>    self.lock()                 # lock new sid
> 
>  File 
> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mod_python/Session.py", 
> line 255, in lock
>    _apache._global_lock(self._req.server, self._sid)
> 
> ValueError: Failed to acquire global mutex lock
> 
> --------------------------------------------------------------------------------- 
> 
> I checked around on Google and people said things like changing the User 
> in the httpd.conf file from nobody to root or some other user. Even 
> though i was not happy with that solution, it did not work for me even 
> with root.
> 
> Any help will be greatly appreciated.
> 
> System: Mac OS X,  python 2.4.3,  mod_python 3.2.10
> 

Take a look at the apache error_log. How many mutexes are being created 
on startup? Are there any log entries complaining about running out of 
mutexes?

Jim


More information about the Mod_python mailing list