<?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>Wil Tan &#187; sysadmin</title>
	<atom:link href="http://dready.org/blog/category/sysadmin/feed/" rel="self" type="application/rss+xml" />
	<link>http://dready.org/blog</link>
	<description>musings on internationalized identifiers: domain names, OpenID, TLDs</description>
	<lastBuildDate>Thu, 15 Dec 2011 03:42:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>httpd exited on signal 11 &#8211; solved</title>
		<link>http://dready.org/blog/2010/07/04/httpd-exited-on-signal-11-solved/</link>
		<comments>http://dready.org/blog/2010/07/04/httpd-exited-on-signal-11-solved/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 14:29:50 +0000</pubDate>
		<dc:creator>wil</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[core]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[segfault]]></category>
		<category><![CDATA[sig11]]></category>

		<guid isPermaLink="false">http://dready.org/blog/?p=270</guid>
		<description><![CDATA[tl;dr
It&#8217;s probably mod_php, and try recompiling PHP without zend_multibyte. If you have WITH_MULTIBYTE=true in /var/db/ports/php5/options, change it to WITHOUT_MULTIBYTE=true and rebuild the port.
Long Story
The Apache 2.2 processes on my FreeBSD box keep dying intermittently, with messages such as:

Jul  3 08:08:37 yama kernel: pid 13526 (httpd), uid 80: exited on signal 10
Jul  3 08:25:58 [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<h4>tl;dr</h4>
<p>It&#8217;s probably mod_php, and try recompiling PHP without zend_multibyte. If you have <code>WITH_MULTIBYTE=true</code> in <code>/var/db/ports/php5/options</code>, change it to <code>WITHOUT_MULTIBYTE=true</code> and rebuild the port.</p>
<h4>Long Story</h4>
<p>The Apache 2.2 processes on my FreeBSD box keep dying intermittently, with messages such as:</p>
<p><code><br />
Jul  3 08:08:37 yama kernel: pid 13526 (httpd), uid 80: exited on signal 10<br />
Jul  3 08:25:58 yama kernel: pid 33050 (httpd), uid 80: exited on signal 11<br />
</code></p>
<p>I&#8217;ve googled around and tried various extensions.ini reordering tricks without luck. Eventually, I figured out how to get Apache to dump core. First, you need to tell Apache where to dump core by adding the <a href="http://httpd.apache.org/docs/2.2/mod/mpm_common.html#coredumpdirectory">CoreDumpDirectory</a> directive to your <code>httpd.conf</code>. Restart apache.</p>
<p>Then, check to make sure that the <code>kern.coredump</code> and <code>kern.sugid_coredump</code> sysctl variables are set to <code>1</code>. Because Apache calls <code>setuid</code> and <code>setgid</code> to the configured user after listening on port 80 (privileged port), FreeBSD by default will refuse to dump core on segfaults. Setting <code>kern.sugid_coredump</code> will make it do so.</p>
<p><code><br />
$ sysctl kern.coredump<br />
kern.coredump: 1<br />
$ sysctl kern.sugid_coredump<br />
kern.sugid_coredump: 0<br />
$ sudo sysctl kern.sugid_coredump=1<br />
kern.sugid_coredump: 0 -> 1<br />
</code></p>
<p>Of course, you&#8217;d also need to make sure that your <code>ulimit</code> doesn&#8217;t prevent it from dumping core:</p>
<p><code><br />
$ ulimit -c<br />
unlimited<br />
</code></p>
<p>Great! Now wait for Apache to segfault (or, if you have a reproducible test case, hit it!)</p>
<p>You should now find <code>httpd.core</code> in the directory that you configured in <code>httpd.conf</code> (in my case, it is <code>/tmp</code>.)</p>
<p>Do the usual gdb stuff:</p>
<p><code><br />
$ gdb /tmp/httpd.core /usr/local/bin/httpd<br />
</code><br />
In my case, I found <code>zend_multibyte_read_script</code> near the top of the stack, so it&#8217;s pretty clear that PHP is to blame.<br />
Did I mention that I abhor PHP? Someday I will get rid of it entirely!</p>
<p>This led me to more googling and <a href="http://lists.freebsd.org/pipermail/freebsd-ports/2010-May/061362.html">found</a> that I may have accidentally enabled Zend Multibyte support (well, its purpose is not very well documented and I just assumed that since I do lots of i18n work, it&#8217;ll come in handy. Okay so it&#8217;s my fault after all but it still shouldn&#8217;t crash!)</p>
<p>Changing <code>WITH_MULTIBYTE=true</code> to <code>WITHOUT_MULTIBYTE=true</code> in <code>/var/db/ports/php5/options</code> and rebuilding the port made the problem go away.</p>
<p>Hopefully, the above will help someone in a similar situation.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://dready.org/blog/2010/07/04/httpd-exited-on-signal-11-solved/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

