Django, Apache and Semaphores
Tuesday, May 24th, 2011At work I use Loki to manage my buildbot infrastructure. It’s deployed on apache via mod_wsgi. Recenlty I’ve been having trouble with Apache crashing with one of two single error lines in the logs:
[notice] seg fault or similar nasty error detected in the parent process
or
[emerg] (28)No space left on device: Couldn’t create accept lock
I came across this post and found it very helpful. Start with seeing if there are left over semaphores when you stop apache:
# ipcs -s | grep apache
If that’s the case then first clear them:
# /usr/bin/ipcs -s | grep apache | awk ‘ { print $2 } ‘ | xargs ipcrm sem
Then tell the kernel to allow more semaphores by adding the followings lines to /etc/sysctl.conf
kernel.msgmni = 1024
kernel.sem = 250 256000 32 1024
then run
# sysctl -p
Once I start everything back up this seems to have fixed my issues.
