Archive

Posts Tagged ‘Semget: No space left on device’

Fixing Apache “No space left on device: Couldn’t create accept lock” errors

April 3rd, 2009 2 comments

Hello,

I was facing same error with one of my shared server last couple of week, apache was broke on server and getting following error in apache error logs file.

[emerg] (28)No space left on device: Couldn't create accept lock
[notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[notice] Digest: generating secret for digest authentication ...
[notice] Digest: done
[warn] pid file /etc/httpd/run/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[emerg] (28)No space left on device: Couldn't create accept lock

I checked disk space, or quota limit but everything was fine. I through it seem to apache semaphore problem

Apache can create the “accept lock” is with a semaphore. A semaphore is an inter-process communication tool that is used by Apache to communicate with it’s child processes. This error message may mean that Apache couldn’t create a new semaphore.

Check to see how many semaphores are currently in use. If Apache is running correctly, you should see something like this:

# ipcs -s

If Apache is stopped, and you still see these semaphores, then you can safely kill them by running this command for each semaphore id (in the second column)

$ ipcrm -s <semid>

To destroy all semaphores, you can run this from the command line (with “apache” being the apache-user:

for semid in `ipcs -s | grep apachec | cut -f2 -d" "`; do ipcrm -s $semid; done

OR

ipcs -s | grep apache | perl -e ‘while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}’

OR

ipcs -s | grep nobody | perl -e ‘while () { @a=split(/\s+/); print `ipcrm sem $a[1]`}’ ipcs -m | grep nobody | perl -e ‘while () { @a=split(/\s+/); print `ipcrm -m $a[1]`}’

OR

for i in `ipcs -s | awk ‘/httpd/ {print $2}’`; do (ipcrm -s $i); done

How to increase semaphore limit

To view the current parameters:

ipcs -l

To change these parameters, modify the file /etc/sysctl.conf and add the following lines:

kernel.msgmni = 1024
kernel.sem = 250 256000 32 1024

Then load these settings with the command:

sysctl -p

Regards

StacyM

System Administrator