[mod_python] Re: Apache/mod_python SSLMutex

David Fraser davidf at sjsoft.com
Wed Oct 27 10:15:50 EDT 2004


LeePatton at woh.rr.com wrote:

>I found your post on the mod_python mailing list about  trouble w/ apache not releasing the mutexes on restart:
>
>http://www.modpython.org/pipermail/mod_python/2004-May/015619.html
>
>I am having that exact same problem. You mentioned adding some code to your init script to get around it. I would greatly appreiciate it if you would post it or send it to me.
>
>Thanks for your time,
>  - Lee
>  
>
Hi Lee

Sorry, my code actually went to python-dev at httpd.apache.org for which I 
think there aren't easy public archives...
Anyway here is my patch:

--- httpd.rpmsave       2004-05-28 16:43:58.000000000 +0200
+++ httpd       2004-06-29 18:20:47.000000000 +0200
@@ -66,6 +66,15 @@
        echo -n $"Stopping $prog: "
        killproc $httpd
        RETVAL=$?
+       removeipcs=`ipcs -s -c | grep apache | cut -d ' ' -f 1`
+       numipcs=`echo $removeipcs | wc -w`
+       if [ $numipcs != 0 ]
+       then
+               echo
+               echo -n $"and removing $numipcs ipcs: "
+               echo $removeipcs | xargs -n 1 ipcrm -s
+               sleep 2
+       fi
        echo
        [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
 }

Note: I've just done this on a machine which has Apache 2 and Apache 1.3 
running concurrently. In this situation it gets a bit more tricky 
because the ipcrm command inadvertently kills the Apache 1.3 process 
which has some ipcs open. So I have to restart it manually.

I still haven't managed to debug exactly why this happens...

David




More information about the Mod_python mailing list