Bug #62886 [Fbk->Asn]: PHP-FPM may segfault/hang on startup
| From: | pierre at archlinux dot de | Date: | Fri, 24 Aug 2012 09:06:27 +0000 |
| Subject: | Bug #62886 [Fbk->Asn]: PHP-FPM may segfault/hang on startup | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-172863@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62886&edit=1
ID: 62886
User updated by: pierre at archlinux dot de
Reported by: pierre at archlinux dot de
Summary: PHP-FPM may segfault/hang on startup
-Status: Feedback
+Status: Assigned
Type: Bug
Package: FPM related
Operating System: Arch Linux
PHP Version: 5.4.6
Assigned To: fat
Block user comment: N
Private report: N
New Comment:
I have attached php.ini and php-fpm.conf as patches (sorry, didn't fint another way to attach
those)
Here is what is different from the configuration shipped with PHP 5.4.6:
The php-fpm.conf is the plain upstream one with this patch applied: https://projects.archlinux.de/svntogit/packages.git/tree/trunk/php-fpm.conf.in.patch?h=packages/php
php.ini is a copy of php.ini-production with this patch applied: https://projects.archlinux.de/svntogit/packages.git/tree/trunk/php.ini.patch?h=packages/php
On top of that I applied the following changes locally: http://paste.xinu.at/Hp6/
Previous Comments:
------------------------------------------------------------------------
[2012-08-24 08:46:19] fat@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
I also need your FPM configuration and your php.ini please
thanks
------------------------------------------------------------------------
[2012-08-24 08:37:27] pierre at archlinux dot de
I rebuild with debug symbols and got the following trace:
Core was generated by `php-fpm'.
Program terminated with signal 11, Segmentation fault.
#0 0x00007fc96b2c6ed6 in _dl_fini () from /lib/ld-linux-x86-64.so.2
(gdb) bt
#0 0x00007fc96b2c6ed6 in _dl_fini () from /lib/ld-linux-x86-64.so.2
#1 0x00007fc96970cb31 in __run_exit_handlers () from /lib/libc.so.6
#2 0x00007fc96970cbb5 in exit () from /lib/libc.so.6
#3 0x00000000008cb754 in fpm_signals_sighandler_exit_ok (pid=10) at
/build/src/php-5.4.6/sapi/fpm/fpm/fpm_signals.c:254
#4 <signal handler called>
#5 0x00007fc96b2cf3c7 in munmap () from /lib/ld-linux-x86-64.so.2
#6 0x00007fc96b2ceb4d in _dl_unmap () from /lib/ld-linux-x86-64.so.2
#7 0x00007fc96b2cba1f in _dl_close_worker () from /lib/ld-linux-x86-64.so.2
#8 0x00007fc96b2cc18c in _dl_close () from /lib/ld-linux-x86-64.so.2
#9 0x00007fc96b2c6736 in _dl_catch_error () from /lib/ld-linux-x86-64.so.2
#10 0x00007fc969fee5fc in ?? () from /lib/libdl.so.2
#11 0x00007fc969fee10f in dlclose () from /lib/libdl.so.2
#12 0x0000000000773e2c in module_destructor (module=0x1ba6050) at
/build/src/php-5.4.6/Zend/zend_API.c:2284
#13 0x000000000077c30f in zend_hash_apply_deleter (ht=0xfb5240 <module_registry>, p=0x1ba5ff0)
at /build/src/php-5.4.6/Zend/zend_hash.c:650
#14 0x000000000077c4aa in zend_hash_graceful_reverse_destroy (ht=0xfb5240 <module_registry>)
at /build/src/php-5.4.6/Zend/zend_hash.c:687
#15 0x0000000000771f97 in zend_destroy_modules () at /build/src/php-5.4.6/Zend/zend_API.c:1797
#16 0x0000000000768e9e in zend_shutdown () at /build/src/php-5.4.6/Zend/zend.c:823
#17 0x00000000006d5151 in php_module_shutdown () at /build/src/php-5.4.6/main/main.c:2346
#18 0x00000000008c7e23 in fpm_php_cleanup (which=2, arg=0x0) at
/build/src/php-5.4.6/sapi/fpm/fpm/fpm_php.c:199
#19 0x00000000008bc629 in fpm_cleanups_run (type=2) at
/build/src/php-5.4.6/sapi/fpm/fpm/fpm_cleanup.c:45
#20 0x00000000008cf1df in fpm_unix_init_main () at /build/src/php-5.4.6/sapi/fpm/fpm/fpm_unix.c:312
#21 0x00000000008bb2df in fpm_init (argc=1, argv=0x7fff252a4a98, config=0x0, prefix=0x0, pid=0x0,
test_conf=0, run_as_root=0) at /build/src/php-5.4.6/sapi/fpm/fpm/fpm.c:59
#22 0x00000000008c7221 in main (argc=1, argv=0x7fff252a4a98) at
/build/src/php-5.4.6/sapi/fpm/fpm/fpm_main.c:1800
------------------------------------------------------------------------
[2012-08-23 22:55:51] fat@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php
for Win32
Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
COuld you please provide the full backtrace please ?
if it's possible, it would be great to enable debug symbols at compilation time
thx
------------------------------------------------------------------------
[2012-08-23 15:41:13] laruence@php.net
fat, could you please look at this one?
------------------------------------------------------------------------
[2012-08-22 08:26:25] pierre at archlinux dot de
Description:
------------
Since PHP 5.4.5 starting php-fpm will either result in a segmentation fault or it will hang under
certain conditions.
It is a little hard to reproduce but it seems it is related to using modules. There more modules get
loaded via php.ini the more likely this bug will get triggered (> 30%); with no modules loaded I
was not able to trigger it.
I started from 5.4.6 and reverted patches applied to sapi/fpm. Once I reverted commit
c2f33fb1293cbcdc94daefb8583ca13e98b5c826, php would no longer crash or hang.
See http://git.php.net/?p=php-src.git;a=commit;h=c2f33fb1293cbcdc94daefb8583ca13e98b5c826
Test script:
---------------
Configure php with a bunch of modules and run something like this:
for i in {1..100};do sudo php-fpm;sleep 0.5;sudo killall php-fpm;sleep 0.5;done
watch dmesg for segfaults like
php-fpm[32571]: segfault at 7f4eabe93cf8 ip 00007f4eae9b1ed6 sp 00007fff87d69310 error 4 in
ld-2.16.so[7f4eae9a3000+21000]
gdb will tell you 0x00007fe0412c1ed6 in _dl_fini () from /lib/ld-linux-x86-64.so.2
Sometimes php-fpm will hang and has to be killed with kill -9.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62886&edit=1