8

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 or service apache2 start.

How can I get a core dump to debug my issue OR how can I attach gdb directly to apache?

9
  • For the former, look here: serverfault.com/questions/470407/… for the latter, here: httpd.apache.org/dev/debugging.html#gdb
    – Elder Geek
    Apr 22, 2015 at 17:06
  • Unfortunately, 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). Apr 22, 2015 at 17:42
  • Is the coredump in /tmp instead perhaps?
    – Elder Geek
    Apr 22, 2015 at 17:58
  • I specified the core dump to be placed in a different folder, so it's not in /tmp. Apr 22, 2015 at 18:14
  • I 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. Apr 22, 2015 at 18:15

1 Answer 1

4

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
3
  • I tried this but it still didn't get Apache (12 LTS) to dump core. Any thoughts? Nov 13, 2015 at 22:03
  • Found the answer - apport was enabled in /etc/default/apport, and it changed the kernel core dump pattern to suit itself. See serverfault.com/questions/470407/… Nov 15, 2015 at 16:27
  • echo '/tmp/apache-coredumps/core-%e.%p' > /proc/sys/kernel/core_pattern
    – Rudger
    Jun 27, 2016 at 13:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .