Fix "No space left on device: Couldn't Create Accept Lock" Errors


On rare occasions, Apache will refuse to start/restart with the following error:

No space left on device: Couldn’t create accept lock

I encountered this recently, and it took me a while to figure out the issue as it was rather misleading (there was more than enough disk and IO nodes free).

Long story short, there were a ton of semaphore-arrays open which were blocking Apache from starting.

In Linux, semaphores are counters used to indicate the state of a resource and are very important for multithreaded applications (such as Apache) as they help prevent things like deadlocks, race conditions, etc. To see the list of semaphores for Apache, run (as root):

ipcs -s | grep www-data

Note that you’ll need to replace ‘www-data’ with whatever user your Apache is running as (ideally, it should be running as it’s own user). Now, to kill any semaphores currently blocking Apache from starting/restarting, run the following Bash for loop (once again, as root):

for sem in `ipcs -s | grep www-data | awk '{print $2}'`; do ipcrm -s ${sem}; done

Once again, replace www-data with the user your Apache is running as.

Once it’s done, you should now be able to get Apache going again.

Next Post
Install Xen on Centos

Previous Post
Reset MySQL Root Password

comments powered by Disqus