Bug #62954 [Com]: startup problems fpm / php-fpm

From: Date: Thu, 13 Sep 2012 14:50:24 +0000
Subject: Bug #62954 [Com]: startup problems fpm / php-fpm
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-173412@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62954&edit=1

 ID:                 62954
 Comment by:         per at techspot dot com
 Reported by:        jonas at brachium-system dot net
 Summary:            startup problems fpm / php-fpm
 Status:             Feedback
 Type:               Bug
 Package:            FPM related
 Operating System:   Linux
 PHP Version:        5.3Git-2012-08-27 (Git)
 Assigned To:        fat
 Block user comment: N
 Private report:     N

 New Comment:

Upgraded to PHP v5.4.7 but the issue remains:

[root@dev01 ~]# service php-fpm stop
Stopping php-fpm:                                          [  OK  ]

[root@dev01 ~]# ps aux | grep php
root     10912  0.0  0.0 103244   840 pts/0    S+   09:45   0:00 grep php

[root@dev01 ~]# service php-fpm start
Starting php-fpm: /bin/bash: line 1: 10923 Segmentation fault      (core dumped) php-fpm
                                                           [FAILED]

[root@dev01 ~]# ps aux | grep php
root     10924  0.0  0.1 516912  5096 ?        Ss   09:45   0:00 php-fpm: master process
(/etc/php-fpm.conf)
nginx    10926  0.0  0.1 516912  4256 ?        S    09:45   0:00 php-fpm: pool www
nginx    10927  0.0  0.1 516912  4256 ?        S    09:45   0:00 php-fpm: pool www
nginx    10928  0.0  0.1 516912  4256 ?        S    09:45   0:00 php-fpm: pool www
nginx    10929  0.0  0.1 516912  4256 ?        S    09:45   0:00 php-fpm: pool www
nginx    10930  0.0  0.1 516912  4256 ?        S    09:45   0:00 php-fpm: pool www



/var/log/messages:
Sep 13 09:45:51 dev01 kernel: php-fpm[10923]: segfault at 3b25051598 ip 0000003b1ca0eb83 sp
00007fffe9cace00 error 4 in ld-2.12.so[3b1ca00000+20000]
Sep 13 09:45:51 dev01 abrt[10925]: Saved core dump of pid 10923 (/usr/sbin/php-fpm) to
/var/spool/abrt/ccpp-2012-09-13-09:45:51-10923 (5709824 bytes)
Sep 13 09:45:51 dev01 abrtd: Directory 'ccpp-2012-09-13-09:45:51-10923' creation detected
Sep 13 09:45:51 dev01 abrtd: Package 'php-fpm' isn't signed with proper key
Sep 13 09:45:51 dev01 abrtd: 'post-create' on
'/var/spool/abrt/ccpp-2012-09-13-09:45:51-10923' exited with 1
Sep 13 09:45:51 dev01 abrtd: Corrupted or bad directory
/var/spool/abrt/ccpp-2012-09-13-09:45:51-10923, deleting


Previous Comments:
------------------------------------------------------------------------
[2012-09-13 10:54:57] jonas at brachium-system dot net

>This only shows us that FPM has successfully forked to detach from the console.
 >It didn't hang, crash or exit, it's still running and you can see it yourself: >
 >ps afx | grep php

yep. every time I start php-fpm with gdb it forks and detach the process correctly. 

Then I start it without debugger it hangs. :(

------------------------------------------------------------------------
[2012-09-12 09:17:54] tony2001@php.net

>Program received signal SIGUSR1, User defined signal 1

This only shows us that FPM has successfully forked to detach from the console.
It didn't hang, crash or exit, it's still running and you can see it yourself: ps
afx | grep php

------------------------------------------------------------------------
[2012-09-10 19:32:56] jonas at brachium-system dot net

I have pulled the current PHP-5.3 branch and compile it with:

 ./configure --prefix=/usr --enable-fpm --enable-bcmath --with-bz2 --enable-calendar --with-curl
--enable-dba --enable-exif --enable-ftp --enable-gd-native-ttf --with-jpeg-dir --with-png-dir
--with-t1lib --with-freetype-dir --with-gettext --enable-mbstring --with-mcrypt --with-mhash
--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mysqlnd --with-openssl
--with-pcre-regex --with-pspell --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg
--enable-wddx  --with-xsl --enable-zip --with-zlib --with-tcadb --with-openssl-dir --with-gd
--enable-debug

I have started PHP with gdb:
-----------------------------
root@testm64:/home/jonas/php-src# gdb sapi/fpm/php-fpm
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/jonas/php-src/sapi/fpm/php-fpm...done.
warning: not using untrusted file "/home/jonas/php-src/.gdbinit"
(gdb) run
Starting program: /home/jonas/php-src/sapi/fpm/php-fpm 
[Thread debugging using libthread_db enabled]

Program received signal SIGUSR1, User defined signal 1.
0x00007ffff49c8380 in ?? () from /lib/libc.so.6
(gdb) bt
#0  0x00007ffff49c8380 in ?? () from /lib/libc.so.6
#1  0x00007ffff49cb94c in free () from /lib/libc.so.6
#2  0x00000000009d416e in zend_hash_destroy (ht=0x132c170) at
/home/jonas/php-src/Zend/zend_hash.c:532
#3  0x00000000009c2cd3 in zend_shutdown () at /home/jonas/php-src/Zend/zend.c:773
#4  0x000000000094b6a3 in php_module_shutdown () at /home/jonas/php-src/main/main.c:2186
#5  0x0000000000abb116 in fpm_php_cleanup (which=2, arg=0x0) at
/home/jonas/php-src/sapi/fpm/fpm/fpm_php.c:199
#6  0x0000000000ab009d in fpm_cleanups_run (type=2) at
/home/jonas/php-src/sapi/fpm/fpm/fpm_cleanup.c:45
#7  0x0000000000ac2109 in fpm_unix_init_main () at /home/jonas/php-src/sapi/fpm/fpm/fpm_unix.c:312
#8  0x0000000000aaed7b in fpm_init (argc=1, argv=0x7fffffffe788, config=0x0, prefix=0x0, pid=0x0,
test_conf=0, run_as_root=0) at /home/jonas/php-src/sapi/fpm/fpm/fpm.c:59
#9  0x0000000000aba69c in main (argc=1, argv=0x7fffffffe788) at
/home/jonas/php-src/sapi/fpm/fpm/fpm_main.c:1805

------------------------------------------------------------------------
[2012-09-10 13:18:31] tony2001@php.net

#4  0xb42fcd66 in pcrecpp::RE::Cleanup() () from /usr/lib/libpcrecpp.so.0
#5  0xb42fce02 in pcrecpp::RE::~RE() () from /usr/lib/libpcrecpp.so.0

This looks like a problem of your system's PCRE library.
No idea why would you use it instead of the bundled, but can you just try a plain PHP version
provided from php.net and see if you still can reproduce the problem? Preferably a recent snapshot,
preferable without any external libs and opcode caches.
This'll help us to understand if this is a genuine FPM problem or something different.

------------------------------------------------------------------------
[2012-09-05 17:06:39] rainer-phpbugs at 7val dot com

I can reproduce this problem with php 5.3.16 on SLES 11.2 x86_64 (after about 20 attempts on
average), but not on Ubuntu 12.04.1 x86_64 or Centos (RHEL) 6.3 (no problem after more than 2000
restarts each).

remove_usr1_usr2_fpm_unix.patch reliably fixes this problem for me.

gdb backtraces of the hanging process always look like this (taken on opensuse 11 i386):

#0  0xffffe424 in __kernel_vsyscall ()
#1  0xb4fe3e53 in __lll_lock_wait_private () from /lib/libc.so.6
#2  0xb4f762fb in _L_lock_10372 () from /lib/libc.so.6
#3  0xb4f74a66 in free () from /lib/libc.so.6
#4  0xb42fcd66 in pcrecpp::RE::Cleanup() () from /usr/lib/libpcrecpp.so.0
#5  0xb42fce02 in pcrecpp::RE::~RE() () from /usr/lib/libpcrecpp.so.0
#6  0xb4f3089f in __run_exit_handlers () from /lib/libc.so.6
#7  0xb4f308fd in exit () from /lib/libc.so.6
#8  0x084c382f in fpm_signals_sighandler_exit_ok (pid=10) at
build/src/external/php-5.3.16/sapi/fpm/fpm/fpm_signals.c:254
#9  <signal handler called>
#10 0xb4f70701 in _int_free () from /lib/libc.so.6
#11 0xb4f74a6d in free () from /lib/libc.so.6
#12 0x08426de0 in zend_hash_destroy (ht=0x891088c) at
build/src/external/php-5.3.16/Zend/zend_hash.c:532
#13 0x08404762 in destroy_zend_class (pce=0x8911cb4) at
build/src/external/php-5.3.16/Zend/zend_opcode.c:206
#14 0x08426dc8 in zend_hash_destroy (ht=0x87aa490) at
build/src/external/php-5.3.16/Zend/zend_hash.c:529
#15 0x08414ed7 in zend_shutdown () at build/src/external/php-5.3.16/Zend/zend.c:762
#16 0x083a84da in php_module_shutdown () at build/src/external/php-5.3.16/main/main.c:2210
#17 0x084bf608 in fpm_php_cleanup (which=2, arg=0x0) at
build/src/external/php-5.3.16/sapi/fpm/fpm/fpm_php.c:199
#18 0x084b5f0c in fpm_cleanups_run (type=2) at
build/src/external/php-5.3.16/sapi/fpm/fpm/fpm_cleanup.c:45
#19 0x084c6c73 in fpm_unix_init_main () at build/src/external/php-5.3.16/sapi/fpm/fpm/fpm_unix.c:340
#20 0x084b4fe8 in fpm_init (argc=3, argv=0xbffb2fe4, config=0xbffb50a5
"conf/php-fpm.conf", prefix=0x0, pid=0x0, test_conf=0, 
    run_as_root=0) at build/src/external/php-5.3.16/sapi/fpm/fpm/fpm.c:59
#21 0x084be0f5 in main (argc=3, argv=0xbffb2fe4) at
build/src/external/php-5.3.16/sapi/fpm/fpm/fpm_main.c:1805

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=62954


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62954&edit=1


Thread (21 messages)

« previous php.bugs (#173412) next »