Enable core dumps with apache, RHEL5
- July 6th, 2009
- Posted in Apache . RHEL . System Administration
- By jrod
- Write comment
If you are like me, you had some trouble getting apache to dump core on a RHEL5 system. The following steps have produced positive results for me:
echo "ulimit -c unlimited >/dev/null 2>&1" >> /etc/profile echo "DAEMON_COREFILE_LIMIT='unlimited'" >> /etc/sysconfig/init echo 1 > /proc/sys/fs/suid_dumpable echo "core.%p" > /proc/sys/kernel/core_pattern echo "CoreDumpDirectory /var/apache-core-dumps" > \ /etc/httpd/conf.d/core_dumps.conf mkdir /var/apache-core-dumps chown apache: /var/apache-core-dumps source /etc/profile /etc/init.d/httpd restart
Now you can test it by sending a SIGSEGV to a random apache child process:
# tail -f /var/log/httpd/error_log | grep -i seg & # ps auxwww |grep httpd (pick a random pid not owned by root) # kill -11 2014 # [Mon Jul 06 21:05:39 2009] [notice] child pid 2014 exit signal Segmentation fault (11), possible coredump in /var/apache-core-dumps # cd /var/apache-core-dumps # ls core.2014
You can then get a backtrace using gdb:
# gdb /usr/sbin/httpd core.2014 (gdb) > bt full
I hope this helps someone. Please feel free to comment.
awesome tutor…
Thanks!
Hi,
This post is a great help.
Now that core dump is generated, is there a way to stop or reverse the process?
Please advice.
Thank you,
Sandeil
To reverse the process, simply remove the file: /etc/httpd/conf.d/core_dumps.conf
Also, remove this line:
DAEMON_COREFILE_LIMIT=’unlimited’
from:
/etc/sysconfig/init
And this line:
ulimit -c unlimited >/dev/null 2>&1
from:
/etc/profile
@jrod
Oh, and also don’t forget to restart apache.
Hi,
I added this steps:
echo 0 > /proc/sys/fs/suid_dumpable
source /etc/profile
restart apache
Thank you