Apache2 Error Log Segmentation Fault
Contents |
on your server can drive you crazy trying to solve it… So, I'm gonna apache segmentation fault explain you how I figured out what was causing the last apache php segmentation fault apache segfault I had. My server was running under Debian Squeeze, with Apache 2.2 and PHP 5.3, mysql segmentation fault and I got randomly segmentation faults: [Jun 08 17:38:07 2012] [notice] child pid 5646 exit signal Segmentation fault (11) [Jun 08 18:21:34 2012] [notice] child pid 8278 exit
Apache Segmentation Fault (core Dumped)
signal Segmentation fault (11) [Jun 08 18:44:59 2012] [notice] child pid 5665 exit signal Segmentation fault (11) 123 [Jun 08 17:38:07 2012] [notice] child pid 5646 exit signal Segmentation fault (11)[Jun 08 18:21:34 2012] [notice] child pid 8278 exit signal Segmentation fault (11)[Jun 08 18:44:59 2012] [notice] child pid 5665 exit signal Segmentation fault (11) apache segmentation fault (11) I supposed the problem was on some php extension, so I deactivated some of them…but the problem was still there :( After spending a lot of time looking for what was causing it, I decided to debug apache with gdb. I installed it through backports because I needed an upper version than gdb 7.0 (7.0.1-2 is the current version on squeeze stable repository) otherwise I got this: "warning: The current binary is a PIE (Position Independent Executable), which GDB does NOT currently support. Most debugger features will fail if used in this session." when I was trying to debug apache: $ echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list && apt-get update $ apt-get -t squeeze-backports install gdb 12 $ echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list && apt-get update$ apt-get -t squeeze-backports install gdb Well, I had the debugger installed, but I also needed the php and apache debug symbols: $ apt-get install apache2-dbg php5-dbg 1 $ apt-get install apache2-dbg php5-dbg Once I had install
(11) If you have, read on. At my day job I deal with both Apache and PHP a lot. If you have ever tried to figure out why your PHP code seems to cause Apache segmentation faults, you probably experienced the same as I did. apache signal segmentation fault Lots of pain, frustration and headaches. However all is not lost. There is a way to
Ah00051 Child Pid Exit Signal Segmentation Fault (11) Possible Coredump In /etc/apache2
figure out what PHP code is making Apache act crazy. I'll try to explain how to debug Apache using gdb to locate that nasty
Apache Coredumpdirectory
bug that is causing you to lose your precious beautysleep. Before webegin Now, Apache does not dump core by default. We need to do some work before that happens. If you don't like to get your hands dirty compiling stuff http://sysadmin.carlusgg.com/?p=197 manually, you should leave now, this is not foryou. Still here? Good! Before we start, make sure youhave: Root access to your webserver Apache source code and everything needed to (re-)compileApache PHP source code (or just download the .gbdinit file) Make Apache dumpcore The first step is to make Apache not change user when it starts up and forks, so we will make it run as root the whole time. To accomplish this we need to compile Apache with -DBIG_SECURITY_HOLE. http://www.omh.cc/blog/2008/mar/6/fixing-apache-segmentation-faults-caused-php/ For obvious reasons, this is not recommended forproduction. 1 2 3make clean export EXTRA_CFLAGS="-DBIG_SECURITY_HOLE" ./configure && make && make install Now specify the "root" as the "User" in httpd.conf. While we're editing httpd.conf we'll add a setting to specify where Apache should put our coredump. 1 2 3User nobody [...] CoreDumpDirectory /tmp/apache Make sure /tmp/apacheexists 1mkdir -p /tmp/apache On most systems the core file size is set to zero by default. We'll go ahead and change it tounlimited. 1ulimit -c 0 You can check your current core dump file size limit byrunning 1ulimit -a RestartApache 1apachectl restart Next time Apache crashes with a Segmentation fault it should make us a core dump. If you did everything correctly you should see something like this in the apacheerror_log. 1 2[notice] child pid 16430 exit signal Segmentation fault (11), possible coredump in /tmp/apache Note: For reasons unclear to me my dump file ended up on the root (/) and not in the directory we specified with CoreDumpDirectory. If anyone knows why please drop me acomment. Making sense of the coredump At this point we could run gdb and get a backtrace, however that will only show us the function called inside php itself and not pinpoint where in our php code the problem is. To get a backtrace of our PHP code we need to use the "dump_bt" function inside the .gbdinit file. Copy the .gbdinit file to your homedirectory 1cp <
New Member Hello! I upgraded my system from Fedora 5 to Fedora 6 (x86_64) using this: http://www.ioncannon.net/system-administration/99/upgrade-fc5-to-fc6-with-yum/ i updated all software via yum update Now httpd (x86_64 2.2.4-2.fc6) not showing PHP https://www.howtoforge.com/community/threads/apache-exit-signal-segmentation-fault-11-php-blank-page.13391/ pages. PHP is installed: php x86_64 5.1.6-3.6.fc6 Error log shows: [Wed Jun 13 17:22:43 2007] [notice] child pid 4998 exit signal Segmentation fault (11) [Wed Jun 13 17:22:52 2007] [error] an unknown filter was not added: PHP http://academe.co.uk/2012/12/apache-segmentation-fault-11-related-to-memory/ [Wed Jun 13 17:22:52 2007] [error] an unknown filter was not added: PHP [Wed Jun 13 17:22:53 2007] [notice] child pid 5004 exit signal Segmentation fault (11) [Wed Jun 13 17:22:55 2007] [error] an unknown filter segmentation fault was not added: PHP [Wed Jun 13 17:22:55 2007] [error] an unknown filter was not added: PHP [Wed Jun 13 17:22:56 2007] [notice] child pid 5007 exit signal Segmentation fault (11) [Wed Jun 13 17:22:57 2007] [error] an unknown filter was not added: PHP [Wed Jun 13 17:22:57 2007] [error] an unknown filter was not added: PHP [Wed Jun 13 17:22:57 2007] [notice] child pid 5012 exit signal Segmentation fault (11)Click to apache segmentation fault expand... When i trying to open .php page i see blank page. .html pages showing normal. I have no idea how to fix it. Please help me. Salvis, Jun 13, 2007 #1 falko Super Moderator ISPConfig Developer Do you use ISPConfig? If so, take a look here: http://www.howtoforge.com/forums/showpost.php?p=57729&postcount=7 falko, Jun 14, 2007 #2 matej New Member Exactly same problem. After I changed what falko proposed I get errors: (9)Bad file descriptor: apr_socket_accept: (client socket) during reload (when I change something in configuration so apache configuration is reloaded). And after that when I click on some PHP site I get error: [notice] child pid XXXXX exit signal Segmentation fault (11), possible coredump in /tmp If I manualy restart apache everything works fine (If I just reload, still get same error). Any Ideas? matej, Jun 29, 2007 #3 falko Super Moderator ISPConfig Developer Is there a coredump in the /tmp directory? falko, Jun 30, 2007 #4 matej New Member Yes, I think so. There are some core.XXXXX files in /tmp directory. matej, Jun 30, 2007 #5 falko Super Moderator ISPConfig Developer What's in the latest one? falko, Jul 1, 2007 #6 matej New Member Hm. Where should I open this file? If I open in editor it has ureadable format... ^?ELF^A^A^A^@^@^@^@^@^@^@^@^@^D^@^C^@^A^@^@^@^@^@^@[emailprotected]^@^@^@^@^@^@^@^@^@^@[emailprotected]^@$
have on both a dedicated server and a VPS. It is not something I've seen before and cannot find any descriptions of others seeing it. I'm logging it here in case a solution comes walking past, so I have my fingers crossed. We are running: CentOS 6.4 Apache/2.2.15 PHP 5.3.19 The problem is related to the user of memory. The maximum memory that a PHP process can use is set to 128Mbyte: memory_limit = 128M When a PHP process attempts to use more memory than this, it halts with an error. This is the kind of thing that can happen all too easily in an application such as SugarCRM: [Mon Dec 17 12:22:30 2012] [error] [client 1.2.3.4] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 523800 bytes) in /var/www/vhosts/example.com/httpdocs/data/SugarBean.php on line 76, referer: http://example.com/index.php?module=Administration&view=module&action=UpgradeWizard_commit So, I tried raising the memory limit to 256M: memory_limit = 256M No more errors were logged. In fact nothing was logged, and I was still getting a white screen. Why no memory errors? The core apache log (/var/log/httpd/error_log) gave some clues here: [Sun Dec 16 01:52:49 2012] [notice] child pid 12415 exit signal Segmentation fault (11) So Apache was creating a segmentation fault - signal 11 - instead of telling me it was running out of memory. Whether this is happening when it reaches 256M, or happens as soon as memory usage exceeds 128M, I don't know. All I do know is that I'm stuffed if I have a process that cannot be optimised to run in 128M of memory. I'm convinced it was working a few weeks ago, so perhaps it is a bug in this version of Apache or PHP? We have Plesk 11 running on the server, and that does its own regular updates, which also patches PHP and Apache. Any clues what could be going on here? Updates: I have no byte cache running on the VPS, but do on the dedicated server. The behaviour is the same in both cases. A segmentation fault is something bad going wrong in memory - the CPU trying to access a block of memory that it cannot or should not be able to access. Assuming the problem is the use of any memory above 128M, and not the act of running out of memory above 128M, then it could be some kind of mis-match between block sizes in CentOS, Apache and PHP. That's just a wild guess though. ----------- I have raised this issue here, and slowly some light is shining on this issue: http://serverfault.com/questions/473797/php-segmentation-fault-when-using-more-than-128m This version of PHP (5.3.21) will segmentation fault if a function is called up recursively enough times. It will occasionally manage to w