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
Share:
9,134

Related videos on Youtube

Andreas Hartmann
Author by

Andreas Hartmann

I am a nerd, or so they say. SOreadytohelp

Updated on September 18, 2022

Comments

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

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

    • Elder Geek
      Elder Geek about 9 years
      For the former, look here: serverfault.com/questions/470407/… for the latter, here: httpd.apache.org/dev/debugging.html#gdb
    • Andreas Hartmann
      Andreas Hartmann about 9 years
      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).
    • Elder Geek
      Elder Geek about 9 years
      Is the coredump in /tmp instead perhaps?
    • Andreas Hartmann
      Andreas Hartmann about 9 years
      I specified the core dump to be placed in a different folder, so it's not in /tmp.
    • Andreas Hartmann
      Andreas Hartmann about 9 years
      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
      Andreas Hartmann about 9 years
      This 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
      Andreas Hartmann about 9 years
      No 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
      Elder Geek about 9 years
  • Rudger
    Rudger almost 8 years
    echo '/tmp/apache-coredumps/core-%e.%p' > /proc/sys/kernel/core_pattern