Enable Apache to Create Core Dumps

From Brian Nelson Ramblings
Revision as of 22:09, 17 November 2013 by Brian (Talk | contribs) (Enable Apache Core Dump)

Jump to: navigation, search
Apachelogo.gif

Configure Apache for core dump on Segmentation Faults

While trying to debug a 500 error the other day, I noticed that it was giving me a Segmentation fault.

> 26619 15:44:43 --- SIGSEGV (Segmentation fault) @ 0 (0) ---

To get rid of this problem I was asked to configure a Linux system so that Apache can dump core files on segmentation faults.

Enable Apache Core Dump

Now Apache does support the CoreDumpDirectory directive, so our first stop is adding this to httpd.conf file.

Open httpd.conf

vim /etc/httpd/conf/httpd.conf

Add the following line to the Main Configuration Section:

CoreDumpDirectory /tmp/core-dump

Now lets create this directory if its not already there

mkdir -p /tmp/core-dump

Set permissions on the folder so Apache can write to it.

chmod 0777 /tmp/core-dump

You will also want to add the following to your Apache init script

vim /etc/init.d/httpd

Add the following to the top of the script

ulimit -c unlimited

If you do not plan to leave core dumps enabled you can just type

ulimit -c unlimited

To verify that -c core variable is set correctly just type:

ulimit -a

To show you all the ulimit variables.

Now we just need to restart Apache web server:

/etc/init.d/httpd restart

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

How to read the Apache web server core dumps

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.

gdb apache2 –core /tmp/core-dump/corefile

Additional Articles: