Apache Segmentation fault

From Noah.org
Revision as of 18:34, 22 May 2007 by Root (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Problem: You see a lot of messages like this in error_log:

 [Tue May 22 11:21:14 2007] [notice] child pid 9322 exit signal Segmentation fault (11)

This is probably caused by a script going haywire. On a site with a lot of traffic it can be impossible to correlate the pid in the error_log with the request in the access_log that is causing the problem because the access_log does not record the pid of the child that is servicing a request.

The solution is to add pid logging to the access_log. Edit your httpd.conf file and add these lines:

 LogFormat "%P %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" pidcombined
 CustomLog logs/access_log pidcombined

Be sure to comment out or replace the existing CustomLog directive. After you restart Apache it will start to record the pid of the child process that is servicing a request. This will not always pinpoint the script exactly. A child will service multiple requests and Apache may not record the last request in the access_log before it segfaults, but this will narrow down the problem.