Saturday 16 February 2013

Apache:No space left on device: Couldn't create accept lock

This is a common issue. Apache fail to start once you try to start and once you check the error logs you will be able to see the following error:

=====
No space left on device: Couldn't create accept lock
=====

First of all, check to make sure that you really aren't out of disk space, or have hit a inode limit.( Use df -h and df -ih)

If both are fine then it means apache is out of semaphores.

What is Semaphore ?
==========
Semaphore can be described as counters used to control access to shared resources by multiple processes. They are most often used as a locking mechanism to prevent processes from accessing a particular resource while another process is performing operations on it.

Think of semaphores as bouncers at a nightclub. There are a dedicated number of people that are allowed in the club at once. If the club is full no one is allowed to enter, but as soon as one person leaves another person might enter.

Fix:
==

You can check this using the following command

#ipcs|grep apache

If you can still see semaphore entries while apache is stop, you will have to remove these semaphore locks. The following script will be handy in that case:

#for i in `ipcs -s | awk '/apache/ {print $2}'`; do (ipcrm -s $i); done

Note:
====
The above script is only for clearing apache semaphores

To clear the shared memory and semaphore pids you can also follow this

for i in `ipcs | awk '{print $2}' | grep -v \[a-zA-Z\]`;do ipcrm -s $i; echo $i; done

No comments:

Post a Comment

Note: only a member of this blog may post a comment.