php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64626 PHP-FPM may segfault/hang on startup
Submitted: 2013-04-10 19:44 UTC Modified: 2017-11-05 04:22 UTC
Votes:11
Avg. Score:4.2 ± 0.9
Reproduced:10 of 10 (100.0%)
Same Version:5 (50.0%)
Same OS:3 (30.0%)
From: zakrzewskim at wp dot pl Assigned:
Status: No Feedback Package: FPM related
PHP Version: 5.4.13 OS: CentOS 5.9 64-bit
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-04-10 19:44 UTC] zakrzewskim at wp dot pl
Description:
------------
This is related to this: https://bugs.php.net/bug.php?id=62886&thanks=7

Bug still exists and many users are reporting this.

There are many segfaults inside dmesg.

PHP 5.4.13 (cli) (built: Mar 14 2013 09:15:29)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and
    with SourceGuardian v9.0.4, Copyright (c) 2000-2012, by Inovica Ltd.

rpm -qi php
Name        : php                          Relocations: (not relocatable)
Version     : 5.4.13                            Vendor: Remi Collet
Release     : 1.el5.remi                    Build Date: czw 14 mar 2013 09:27:38 CET
Install Date: sob 16 mar 2013 18:44:01 CET      Build Host: dixsept.famillecollet.com
Group       : Development/Languages         Source RPM: php-5.4.13-1.el5.remi.src.rpm
Size        : 9294225                          License: PHP and Zend and BSD
Signature   : DSA/SHA1, czw 14 mar 2013 09:45:45 CET, Key ID 004e6f4700f97f56
Packager    : http://blog.famillecollet.com/
URL         : http://www.php.net/
Summary     : Osadzany w HTML-u język skryptowy PHP (PHP: preprocesor hipertekstu).
Description :
PHP is an HTML-embedded scripting language. PHP attempts to make it
easy for developers to write dynamically generated webpages. PHP also
offers built-in database integration for several commercial and
non-commercial database management systems, so writing a
database-enabled webpage with PHP is fairly simple. The most common
use of PHP coding is probably as a replacement for CGI scripts.

The php package contains the module which adds support for the PHP
language to Apache HTTP Server.

Test script:
---------------
It happens on highly loaded servers.

Expected result:
----------------
No segfaults, stable operation.

Actual result:
--------------
[04-Apr-2013 22:38:37] ERROR: unable to read what child say: Bad file descriptor (9)
[04-Apr-2013 22:38:55] ERROR: unable to read what child say: Bad file descriptor (9)
[04-Apr-2013 22:38:55] ERROR: unable to read what child say: Bad file descriptor (9)
[04-Apr-2013 22:38:55] ERROR: unable to read what child say: Bad file descriptor (9)
[04-Apr-2013 22:38:55] ERROR: unable to read what child say: Bad file descriptor (9)
[04-Apr-2013 22:38:55] ERROR: unable to read what child say: Bad file descriptor (9)
[04-Apr-2013 22:38:55] ERROR: unable to read what child say: Bad file descriptor (9)


php-fpm[19644]: segfault at 7fff30199fe0 ip 0000000000574e30 sp 00007fff30199fb0 error 6 in php-fpm[400000+32a000]
php-fpm[18003]: segfault at 7fff30199fe0 ip 0000000000574e30 sp 00007fff30199fb0 error 6 in php-fpm[400000+32a000]
php-fpm[9699]: segfault at 7fff30199fe0 ip 0000000000574e30 sp 00007fff30199fb0 error 6 in php-fpm[400000+32a000]
php-fpm[17649]: segfault at 7fff30199fe0 ip 0000000000574e30 sp 00007fff30199fb0 error 6 in php-fpm[400000+32a000]
php-fpm[13203]: segfault at 7fff30199fe0 ip 0000000000574e30 sp 00007fff30199fb0 error 6 in php-fpm[400000+32a000]
php-fpm[21313]: segfault at 7ffeff931fa0 ip 0000000000574e30 sp 00007ffeff931f70 error 6 in php-fpm[400000+32a000]
php-fpm[4705]: segfault at 7fff84be5fa0 ip 0000000000574e30 sp 00007fff84be5f70 error 6 in php-fpm[400000+32a000]
php-fpm[24508]: segfault at 7fff84be5fa0 ip 0000000000574e30 sp 00007fff84be5f70 error 6 in php-fpm[400000+32a000]

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-08-19 11:55 UTC] admin at areainter dot net
Got the same issue on Debian 7 Wheezy.

# dpkg-query -l |grep php
ii  libssh2-php                      0.11.3-0.1+b2              amd64        PHP Bindings for libssh2
ii  php-pear                         5.4.4-14+deb7u2            all          PEAR - PHP Extension and Application Repository
ii  php5-cgi                         5.4.4-14+deb7u2            amd64        server-side, HTML-embedded scripting language (CGI binary)
ii  php5-cli                         5.4.4-14+deb7u2            amd64        command-line interpreter for the php5 scripting language
ii  php5-common                      5.4.4-14+deb7u2            amd64        Common files for packages built from the php5 source
ii  php5-curl                        5.4.4-14+deb7u2            amd64        CURL module for php5
ii  php5-fpm                         5.4.4-14+deb7u2            amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php5-gd                          5.4.4-14+deb7u2            amd64        GD module for php5
ii  php5-imagick                     3.1.0~rc1-1+b2             amd64        ImageMagick module for php5
ii  php5-mcrypt                      5.4.4-14+deb7u2            amd64        MCrypt module for php5
ii  php5-memcached                   2.0.1-6                    amd64        memcached extension module for PHP5, uses libmemcached
ii  php5-mysql                       5.4.4-14+deb7u2            amd64        MySQL module for php5


PHP process died when I done php-fpm reload. Request processing failed with 500 error.

php-fpm.log records:

[19-Aug-2013 09:45:27] NOTICE: Reloading in progress ...
[19-Aug-2013 09:45:27] ERROR: unable to read what child say: Bad file descriptor (9)
[19-Aug-2013 09:45:27] ERROR: unable to read what child say: Bad file descriptor (9)
[19-Aug-2013 09:45:27] NOTICE: reloading: execvp("/usr/sbin/php5-fpm", {"/usr/sbin/php5-fpm", "--fpm-config", "/etc/php5/fpm/php-fpm.conf"})

Apache log has error records about request, processed at restart time:

[Mon Aug 19 09:45:27 2013] [error] [client 1.2.3.4] (104)Connection reset by peer: FastCGI: comm with server "/external-php5-fpm-my000" aborted: read failed
[Mon Aug 19 09:45:27 2013] [error] [client 1.2.3.4] FastCGI: incomplete headers (0 bytes) received from server "/external-php5-fpm-000" 


Dmesg:

[4377941.041373] php5-fpm[27812]: segfault at 0 ip 00000000006abcaa sp 00007fff1049b690 error 4 in php5-fpm[400000+6fd000]
[4378139.374307] php5-fpm[30689]: segfault at 418 ip 00000000006abcaa sp 00007fff1049b690 error 4 in php5-fpm[400000+6fd000]
[4394853.530482] php5-fpm[16427]: segfault at 13031 ip 00000000006abcaa sp 00007fff1049b690 error 4 in php5-fpm[400000+6fd000]
[4398633.104253] php5-fpm[21373]: segfault at ffffffff00000054 ip 00000000006abcaa sp 00007fff1049b690 error 5 in php5-fpm[400000+6fd000]



--------
Also I can notice periodical error occurrence without php-fpm restarts or reloads, for example:

# cat php5-fpm.log |grep -E "ERROR|signal"

[19-Aug-2013 03:11:31] WARNING: [pool mypool] child 27812 exited on signal 11 (SIGSEGV) after 87.231127 seconds from start
[19-Aug-2013 03:14:50] WARNING: [pool mypool] child 30689 exited on signal 11 (SIGSEGV) after 43.602870 seconds from start
[19-Aug-2013 06:25:25] WARNING: [pool mypool] child 13080 exited on signal 11 (SIGSEGV) after 18.955256 seconds from start
[19-Aug-2013 07:53:49] WARNING: [pool mypool] child 16427 exited on signal 11 (SIGSEGV) after 43.778338 seconds from start
[19-Aug-2013 08:56:55] WARNING: [pool mypool] child 21373 exited on signal 11 (SIGSEGV) after 49.748888 seconds from start
[19-Aug-2013 09:00:25] ERROR: unable to read what child say: Bad file descriptor (9)
[19-Aug-2013 09:45:27] ERROR: unable to read what child say: Bad file descriptor (9)
[19-Aug-2013 09:45:27] ERROR: unable to read what child say: Bad file descriptor (9)
[19-Aug-2013 10:40:46] WARNING: [pool mypool] child 6684 exited on signal 11 (SIGSEGV) after 40.652017 seconds from start
[19-Aug-2013 12:06:16] ERROR: unable to read what child say: Bad file descriptor (9)
[19-Aug-2013 12:06:16] ERROR: unable to read what child say: Bad file descriptor (9)
 [2013-12-09 08:58 UTC] tony2001@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: tony2001
 [2013-12-09 08:58 UTC] tony2001@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.

Would be nice to have some more info.
Either of these would do: a short reproduce script, some steps required to reproduce the issue or a GDB backtrace.
Backtrace is probably the easiest to get.
 [2017-10-24 05:02 UTC] kalle@php.net
-Status: Assigned +Status: Feedback -Assigned To: tony2001 +Assigned To:
 [2017-11-05 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC