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?

  • For the former, look here: serverfault.com/questions/470407/… for the latter, here: httpd.apache.org/dev/debugging.html#gdb – Elder Geek Apr 22 '15 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). – Andreas Hartmann Apr 22 '15 at 17:42
  • Is the coredump in /tmp instead perhaps? – Elder Geek Apr 22 '15 at 17:58
  • I specified the core dump to be placed in a different folder, so it's not in /tmp. – Andreas Hartmann Apr 22 '15 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. – Andreas Hartmann Apr 22 '15 at 18:15
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
  • I tried this but it still didn't get Apache (12 LTS) to dump core. Any thoughts? – Josip Rodin Nov 13 '15 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/… – Josip Rodin Nov 15 '15 at 16:27
  • echo '/tmp/apache-coredumps/core-%e.%p' > /proc/sys/kernel/core_pattern – Rudger Jun 27 '16 at 13:35

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.