php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67320 Ignored sigpipes in php-fpm cause php to become unresponsive
Submitted: 2014-05-21 19:36 UTC Modified: 2014-05-22 02:10 UTC
Votes:5
Avg. Score:4.4 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:4 (100.0%)
From: ryan at rmauger dot co dot uk Assigned:
Status: Open Package: FPM related
PHP Version: 5.5.12 OS: Linux / Debian 6/7
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-05-21 19:36 UTC] ryan at rmauger dot co dot uk
Description:
------------
As sigpipe appears to be ignored (http://lxr.php.net/xref/PHP_TRUNK/sapi/fpm/fpm/fpm_main.c#1584) when a sigpipe is recieved, the fcgi_request here https://github.com/php/php-src/blob/master/sapi/fpm/fpm/fastcgi.c#L316 appears to always be null, and so all subsiquent requests to all workers via nginx are treated as bad gateway errors. 

Below is a backtrace from a worker where this has occured.

Core was generated by `/opt/php/sbin/php-fpm'.
Program terminated with signal 13, Broken pipe.
#0  0x00007ff6eb0160d0 in __write_nocancel () from /lib/libpthread.so.0
(gdb) bt
#0  0x00007ff6eb0160d0 in __write_nocancel () from /lib/libpthread.so.0
#1  0x0000000000b5e00a in safe_write (req=0x7fffcc4715e0, buf=0x58a8158, count=33520) at /usr/local/src/php-5.4.28/sapi/fpm/fpm/fastcgi.c:316
#2  0x0000000000b5fb4c in fcgi_write (req=0x7fffcc4715e0, type=FCGI_STDOUT, 
    str=0x58a8158 "<!DOCTYPE html>\n<!--[if lt IE 7]> <html class=\"no-js ie6 oldie\" lang=\"en\"> <![endif]-->\n<!--[if IE 7]>    <html class=\"no-js ie7 oldie\" lang=\"en\"> <![endif]-->\n<!--[if IE 8]>    <html class=\"no-js ie8"..., len=33522) at /usr/local/src/php-5.4.28/sapi/fpm/fpm/fastcgi.c:1023
#3  0x0000000000b68d3b in sapi_cgibin_single_write (
    str=0x58a8158 "<!DOCTYPE html>\n<!--[if lt IE 7]> <html class=\"no-js ie6 oldie\" lang=\"en\"> <![endif]-->\n<!--[if IE 7]>    <html class=\"no-js ie7 oldie\" lang=\"en\"> <![endif]-->\n<!--[if IE 8]>    <html class=\"no-js ie8"..., str_length=33522, tsrm_ls=0x2463510) at /usr/local/src/php-5.4.28/sapi/fpm/fpm/fpm_main.c:279
#4  0x0000000000b68db7 in sapi_cgibin_ub_write (
    str=0x58a8158 "<!DOCTYPE html>\n<!--[if lt IE 7]> <html class=\"no-js ie6 oldie\" lang=\"en\"> <![endif]-->\n<!--[if IE 7]>    <html class=\"no-js ie7 oldie\" lang=\"en\"> <![endif]-->\n<!--[if IE 8]>    <html class=\"no-js ie8"..., str_length=33522, tsrm_ls=0x2463510) at /usr/local/src/php-5.4.28/sapi/fpm/fpm/fpm_main.c:305
#5  0x0000000000a0a698 in php_output_op (op=0, 
    str=0x589fd88 "<!DOCTYPE html>\n<!--[if lt IE 7]> <html class=\"no-js ie6 oldie\" lang=\"en\"> <![endif]-->\n<!--[if IE 7]>    <html class=\"no-js ie7 oldie\" lang=\"en\"> <![endif]-->\n<!--[if IE 8]>    <html class=\"no-js ie8"..., len=33522, tsrm_ls=0x2463510) at /usr/local/src/php-5.4.28/main/output.c:1093
#6  0x0000000000a080b5 in php_output_write (
    str=0x589fd88 "<!DOCTYPE html>\n<!--[if lt IE 7]> <html class=\"no-js ie6 oldie\" lang=\"en\"> <![endif]-->\n<!--[if IE 7]>    <html class=\"no-js ie7 oldie\" lang=\"en\"> <![endif]-->\n<!--[if IE 8]>    <html class=\"no-js ie8"..., len=33522, tsrm_ls=0x2463510) at /usr/local/src/php-5.4.28/main/output.c:269
#7  0x00000000009ed1f0 in php_output_wrapper (
    str=0x589fd88 "<!DOCTYPE html>\n<!--[if lt IE 7]> <html class=\"no-js ie6 oldie\" lang=\"en\"> <![endif]-->\n<!--[if IE 7]>    <html class=\"no-js ie7 oldie\" lang=\"en\"> <![endif]-->\n<!--[if IE 8]>    <html class=\"no-js ie8"..., str_length=33522) at /usr/local/src/php-5.4.28/main/main.c:1868
#8  0x0000000000aa1426 in zend_print_zval_ex (write_func=0x9ed1b8 <php_output_wrapper>, expr=0x5815b18, indent=0) at /usr/local/src/php-5.4.28/Zend/zend.c:330
#9  0x0000000000aa13a1 in zend_print_zval (expr=0x5815b18, indent=0) at /usr/local/src/php-5.4.28/Zend/zend.c:311
#10 0x0000000000aa0170 in zend_print_variable (var=0x5815b18) at /usr/local/src/php-5.4.28/Zend/zend_variables.c:154
#11 0x0000000000b3db7d in ZEND_ECHO_SPEC_CV_HANDLER (execute_data=0x7ff6f03f6710, tsrm_ls=0x2463510) at /usr/local/src/php-5.4.28/Zend/zend_vm_execute.h:26793
#12 0x0000000000ae818b in execute (op_array=0x426d618, tsrm_ls=0x2463510) at /usr/local/src/php-5.4.28/Zend/zend_vm_execute.h:410
#13 0x0000000000aa5438 in zend_execute_scripts (type=8, tsrm_ls=0x2463510, retval=0x0, file_count=3) at /usr/local/src/php-5.4.28/Zend/zend.c:1315
#14 0x00000000009eea06 in php_execute_script (primary_file=0x7fffcc473630, tsrm_ls=0x2463510) at /usr/local/src/php-5.4.28/main/main.c:2502
#15 0x0000000000b6d2bb in main (argc=3, argv=0x7fffcc473868) at /usr/local/src/php-5.4.28/sapi/fpm/fpm/fpm_main.c:1933
(gdb) x 0x7fffcc4715e0
0x7fffcc4715e0:	0x00000000


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 15:01:24 2019 UTC