Difference between revisions of "Enable Apache to Create Core Dumps"

From Brian Nelson Ramblings
Jump to: navigation, search
(How to read the Apache web server core dumps =)
(How to read the Apache web server core dumps)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[File:Apachelogo.gif|right]]
 
==Configure Apache for core dump on Segmentation Faults==
 
==Configure Apache for core dump on Segmentation Faults==
  
Line 32: Line 33:
 
Add the following to the top of the script
 
Add the following to the top of the script
 
  ulimit -c unlimited
 
  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:
 
Now we just need to restart Apache web server:
Line 42: Line 53:
 
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.
 
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 /path/to/corefile
+
  gdb apache2 –core /tmp/core-dump/corefile
  
 
Additional Articles:
 
Additional Articles:
 
* [[Check the Version of Package]]
 
* [[Check the Version of Package]]
 
* [[How to install Sphinx on Centos Server]]
 
* [[How to install Sphinx on Centos Server]]
* [[How to install Redis on a Centos 6.4 Server]
+
* [[How to install Redis on a Centos 6.4 Server]]

Latest revision as of 22:13, 17 November 2013

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: