Monday, July 16, 2012

Semaphore issues

When we get a semaphore error while trying to restart apache like the following

critical_create(): semget() failed: No space left on device.

 # ipcs

From here you can see the sephore process running on the server.
 You will get a output like this:
Message Queues:
T ID KEY MODE OWNER GROUP

Semaphores:
T ID KEY MODE OWNER GROUP
s 524288 0 --rw------- apache apache
s 9240577 0 --rw------- apache apache
s 6684674 0 --rw------- apache apache
s 393219 0 --rw------- apache apache

If apache's not up and running, you can "ipcrm" them like this:
ipcrm -s 524288
Or execute a loop to ipcrm all apache
for i in `ipcs -s | grep apache | awk '{ print $2; }'`; do ipcrm -s $i; done

To increase semaphore value
sysctl kernel.sem //check current value
echo "kernel.sem=500 128000 64 256" >>/etc/sysctl.conf // append settings #pacifichost example
sysctl -f /etc/sysctl.conf //to load the new parameters

No comments:

Post a Comment