≡ Menu

apache core dump

Recently I have noticed that my Apache error log file shows it is generating segmentation faults. After doing little research I came to know that there is not simple solution to find of causes of this problem. I got an error that read as follows:

[Mon May 8 11:20:09 2006] [notice] Apache/2 (WebAppBETA) child pid 1256 exit signal Segmentation fault (11)
[Mon May 8 11:23:12 2006] [notice] Apache/2 (WebAppBETA) child pid 1301 exit signal Segmentation fault (11)

The problem is that our application development team has hacked (aka modified source code) Apache 2.0 source tree for application my company developing. To get rid of this problem I was asked to configure a Linux system so that Apache can dump core files on segmentation faults.

Apache Core Dump

Apache supports CoreDumpDirectory directive. This controls the directory to which Apache attempts to switch before dumping core. So all I need to do is put line as follows in httpd.conf:

Open httpd.conf:
# vi httpd.conf
Add following line main config section:
CoreDumpDirectory /tmp/apache2-gdb-dump
Create a directory /tmp/apache2-gdb-dump:
# mkdir -p /tmp/apache2-gdb-dump
Set permission:
# chown httpd:appserver /tmp/apache2-gdb-dump
# chmod 0777 /tmp/apache2-gdb-dump

Please note that we are using httpd user and group appserver. Please replace it with your actual Apache user:group combination.

And restart the Apache web server:
# /etc/init.d/httpd restart
OR kill Apache PID:
# kill -11 14658
Now you should see core dumps in /tmp/apache2-gdb-dump directory:
# ls /tmp/apache2-gdb-dump

How do I read the core dump files created by Apache on Linux systems?

Well I am not a developer but they are using gdb and other techniques to analyses the core dumps. Read man page of gdb for more information.

I hope that I will get a new patched version of Apache by next week. Another interesting fact I noticed that you need to configure Core Dumps on Linux only. We are also using FreeBSD for testing and it write core dump in the ServerRoot directory.

If Apache starts as root and switches to another user, the Linux kernel disables core dumps even if the directory is writable for the process. Apache (2.0.46 and later) enables core dumps on Linux 2.4 and beyond, but only if you explicitly configure a CoreDumpDirectory. :)