apache with a segmentation fault

i deployed a python app on a live server and the only output i got was a blank page. there was no error in the virtual hosts log file and it stopped somewhere during the execution of the script. in the apache error log file i found the following line: child pid 15136 exit signal Segmentation fault (11) a very informative and helpful message. after a bit of googling i found out that the gdb would help. gdb is short for GNU Project Debugger. in the file /usr/share/doc/apache2.2-common/README.backtrace there is a short howto to get a stacktrace of a segmentation fault in apache… at least on debian based systems. here is a short overview of what there is to do. at first it’s necessary to install the following packages: apt-get install apache2-dbg libapr1-dbg libaprutil1-dbg gdb add the line CoreDumpDirectory /var/cache/apache2 to your apache config, usually /etc/apache/apache2.conf. after a restart of apache it should now create a memory dump named /var/cache/apache2/core which can be analysed with gdb. it might be necessary to set the maximum size of the coredump like following (inclusive restart of apache): /etc/init.d/apache2 stop ulimit -c unlimited /etc/init.d/apache2 start to analyze the core dump you need to execute the gdb like following: gdb /usr/sbin/apache2 /var/cache/apache2/core (gdb) bt full ... (gdb) quit if you use the threaded mpm (unlikely) then you need to use gdb /usr/sbin/apache2 /var/cache/apache2/core (gdb) thread apply all bt full ... (gdb) quit my dump produced following output: #0 0xb7dd86a5 in free () from /lib/libc.so.6 #1 0xb6675011 in RelinquishMagickMemory () from /usr/lib/libMagick.so.9 #2 0xb6625ba0 in DestroyDrawInfo () from /usr/lib/libMagick.so.9 #3 0xb57d9857 in Magick::Options::~Options () from /usr/lib/libMagick++.so.10 #4 0xb57d6725 in Magick::ImageRef::~ImageRef () from /usr/lib/libMagick++.so.10 #5 0xb57cbfe6 in Magick::Image::~Image () from /usr/lib/libMagick++.so.10 #6 0xb59ed7f3 in boost::python::objects::value_holder::~value_holder () from /var/lib/python-support/python2.5/PythonMagick/_PythonMagick.so #7 0xb581adea in ?? () from /usr/lib/libboost_python-gcc42-1_34_1-py25.so.1.34.1 #8 0xb6ce6f4f in ?? () from /usr/lib/libpython2.5.so.1.0 #9 0×0889a39c in ?? () #10 0xb6d8f7e0 in ?? () from /usr/lib/libpython2.5.so.1.0 #11 0xbf80d088 in ?? () #12 0xb6ce6c60 in ?? () from /usr/lib/libpython2.5.so.1.0 #13 0×00000000 in ?? () i was using pythonMagick which uses Magick++ wich uses ImageMagick. it was a bit irritating that Magick++ version 10 used ImageMagick version 9 instead of 10. after removing ImageMagick version 9 the problem was gone. no idea why it used the wrong version.

Leave a Reply