How to get an apache core dump?
9,134
ulimit -c unlimited
only effects your current shell.
You can confirm this by looking at output cat /proc/$(pidof -s apache2)
.
I added ulimit -c unlimited
to /etc/default/apache2
and now cat /proc/$(pidof -s apache2)/limits
includes
Max core file size unlimited unlimited bytes
Related videos on Youtube
Comments
-
Andreas Hartmann over 1 year
I am having problems with my 14.10 Ubuntu Server. Upon performing certain actions my apache2 restarts with a segmentation fault error. In order to debug this issue I would like to create a core dump. I have done the following:
- added
CoreDumpDirectory /tmp/apache-coredumps
to the config file - Run
ulimit -c unlimited
- Run
apt-get install apache2-dbg php5-dbg
- restarted
apache
and caused the error. The log claims there may be a core dump in the directory, however it is empty.
I also tried to use gdb directly on the executable of apache2, but apache won't start unless started through
apachectl
orservice apache2 start
.How can I get a core dump to debug my issue OR how can I attach
gdb
directly to apache?-
Elder Geek about 9 yearsFor the former, look here: serverfault.com/questions/470407/… for the latter, here: httpd.apache.org/dev/debugging.html#gdb
-
Andreas Hartmann about 9 yearsUnfortunately, this didn't work. I tried setting the permissions as suggested in the first link, however still no core is dumped. I already knew the second link. It doesn't really answer my question in an ubuntu specific manner (Ubuntu doesn't have an httpd executable, and calling apache2 directly doesn't work for previously mentioned reasons).
-
Elder Geek about 9 yearsIs the coredump in /tmp instead perhaps?
-
Andreas Hartmann about 9 yearsI specified the core dump to be placed in a different folder, so it's not in /tmp.
-
Andreas Hartmann about 9 yearsI don't want to use apport, I want to examine my problem locally and not report an error, because it's probably not an apache bug.
-
Andreas Hartmann about 9 yearsThis doesn't really help. Keep in mind I'm on Ubuntu server, only connected via ssh. Apport seems to be a GUI to create core dumps.
-
Andreas Hartmann about 9 yearsNo problem. It's a hosted virtual server so no point in ram testing. Segfaults often occur when there are incompatibilities for example with php.
-
Elder Geek about 9 yearsDid you see this? httpd.apache.org/dev/debugging.html
- added
-
Rudger almost 8 yearsecho '/tmp/apache-coredumps/core-%e.%p' > /proc/sys/kernel/core_pattern