Graham Dumpleton
grahamd at dscpl.com.au
Tue Nov 7 18:23:07 EST 2006
That is not the Python global interpreter lock. It is a mutex lock created using Apache for the purposes of mediating access to session stuff. Thus, you probably need to look into the lock mechanism of Apache and try and understand it. The issue may be the initial permissions used when mod_python initialises/acquires the locks. Specifically look around the call to apr_global_mutex_create() in init_mutexes() in src/mod_python.c source code. Graham Sam Morris wrote .. > I'm experimenting with the ITK MPM for Apache, available > from <http://home.samfundet.no/~sesse/mpm-itk/>. It is based on the > Prefork MPM; after a request is parsed, the process handling the > request changes user id to one specified in the config for the virtual > host. > > I'm having trouble getting mod_python's session support to work. When > trying to create a new instance of Session, I get this message: > > [warn] (13)Permission denied: Failed to acquire global mutex > lock at index 6" > > Strace says the following system call fails: > > semop(4227100, 0xb7ca6a30, 1) = -1 EACCES (Permission denied) > > and ipcs(1) says: > > ------ Semaphore Arrays -------- > 0x00000000 4227100 www-data 600 1 > > I assume this is because the child process (running as user test1) needs > access to the semaphore (for the Global Interpreter Lock?) living inside > a > process that is running as www-data. If this is the case, I guess there's > no way past this problem short of redesigning (mod_)python and/or > apache/ITK? :) > > Here's the full traceback: > > Mod_python error: "PythonHandler pytest" > > Traceback (most recent call last): > File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299, > in HandlerDispatch > result = object(req) > File "/home/sam/pytest/pytest.py", line 8, in handler > s = Session.Session (req) > File "/usr/lib/python2.4/site-packages/mod_python/Session.py", line 735, > in Session > timeout=timeout, lock=lock) > File "/usr/lib/python2.4/site-packages/mod_python/Session.py", line 337, > in __init__ > timeout=timeout, lock=lock) > File "/usr/lib/python2.4/site-packages/mod_python/Session.py", line 165, > in __init__ > self.lock() > File "/usr/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 > > And my apache configuration: > > <VirtualHost *> > DocumentRoot /var/www/ > AssignUserId test1 test1 > ServerName test1 > > ErrorLog /var/log/apache2/error.log > LogLevel warn > CustomLog /var/log/apache2/access.log combined > > SetHandler mod_python > PythonPath "['/home/sam/pytest'] + sys.path" > PythonHandler pytest > PythonOption session_directory /tmp > PythonOption mutex_directory /tmp > PythonDebug on > </VirtualHost> > > -- > Sam Morris > http://robots.org.uk/ > > PGP key id 1024D/5EA01078 > 3412 EA18 1277 354B 991B C869 B219 7FDB 5EA0 1078 > > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python
|