<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Racker Hacker &#187; semaphore</title>
	<atom:link href="http://rackerhacker.com/tag/semaphore/feed/" rel="self" type="application/rss+xml" />
	<link>http://rackerhacker.com</link>
	<description>Words of wisdom from a server administrator</description>
	<lastBuildDate>Wed, 16 May 2012 12:55:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Apache: No space left on device: Couldn&#039;t create accept lock</title>
		<link>http://rackerhacker.com/2007/08/24/apache-no-space-left-on-device-couldnt-create-accept-lock/</link>
		<comments>http://rackerhacker.com/2007/08/24/apache-no-space-left-on-device-couldnt-create-accept-lock/#comments</comments>
		<pubDate>Fri, 24 Aug 2007 21:55:30 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[emergency]]></category>
		<category><![CDATA[quotas]]></category>
		<category><![CDATA[semaphore]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/2007/08/24/apache-no-space-left-on-device-couldnt-create-accept-lock/</guid>
		<description><![CDATA[This error completely stumped me a couple of weeks ago. Apparently someone was adjusting the Apache configuration, then they checked their syntax and attempted to restart Apache. It went down without a problem, but it refused to start properly, and didn't bind to any ports. Within the Apache error logs, this message appeared over and [...]<p><a href="http://rackerhacker.com/2007/08/24/apache-no-space-left-on-device-couldnt-create-accept-lock/">Apache: No space left on device: Couldn't create accept lock</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>This error completely stumped me a couple of weeks ago.  Apparently someone was adjusting the Apache configuration, then they checked their syntax and attempted to restart Apache.  It went down without a problem, but it refused to start properly, and didn't bind to any ports.</p>
<p>Within the Apache error logs, this message appeared over and over:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[emerg] (28)No space left on device: Couldn't create accept lock</pre></div></div>

<p>Apache is basically saying "I want to start, but I need to write some things down before I can start, and I have nowhere to write them!"  If this happens to you, check these items in order:</p>
<p><strong>1. Check your disk space</strong><br />
This comes first because it's the easiest to check, and sometimes the quickest to fix.  If you're out of disk space, then you need to fix that problem. <img src='http://rackerhacker.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><strong>2. Review filesystem quotas</strong><br />
If your filesystem uses quotas, you might be reaching a quota limit rather than a disk space limit.  Use <code>repquota /</code> to review your quotas on the root partition.  If you're at the limit, raise your quota or clear up some disk space.  Apache logs are usually the culprit in these situations.</p>
<p><strong>3. Clear out your active semaphores</strong><br />
Semaphores?  What the heck is a semaphore?  Well, it's actually an <a href="http://en.wikipedia.org/wiki/Semaphore">apparatus for conveying information by means of visual signals</a>.  But, when it comes to programming, <a href="http://en.wikipedia.org/wiki/Semaphore_%28programming%29">semaphores are used for communicating between the active processes of a certain application</a>.  In the case of Apache, they're used to communicate between the parent and child processes.  If Apache can't write these things down, then it can't communicate properly with all of the processes it starts.</p>
<p>I'd assume if you're reading this article, Apache has stopped running.  Run this command as root:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># ipcs -s</pre></div></div>

<p>If you see a list of semaphores, Apache has not cleaned up after itself, and some semaphores are stuck.  Clear them out with this command:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># for i in `ipcs -s | awk '/httpd/ {print $2}'`; do (ipcrm -s $i); done</pre></div></div>

<p>Now, in almost all cases, Apache should start properly.  If it doesn't, you may just be completely out of available semaphores.  You may want to increase your available semaphores, and you'll need to tickle your kernel to do so.  Add this to /etc/sysctl.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">kernel.msgmni = 1024
kernel.sem = 250 256000 32 1024</pre></div></div>

<p>And then run <code>sysctl -p</code> to pick up the new changes.</p>
<p>Further reading:<br />
<a href="http://en.wikipedia.org/wiki/Semaphore_%28programming%29">Wikipedia: Semaphore (Programming)</a><br />
<a href="http://www.webpipe.net/howto/Apache_accept_lock_fix">Apache accept lock fix</a></p>
<p><a href="http://rackerhacker.com/2007/08/24/apache-no-space-left-on-device-couldnt-create-accept-lock/">Apache: No space left on device: Couldn't create accept lock</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2007/08/24/apache-no-space-left-on-device-couldnt-create-accept-lock/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

