Bug #67320 [Opn]: Ignored sigpipes in php-fpm cause php to become unresponsive
| From: | bukka@php.net | Date: | Mon, 06 Dec 2021 23:12:07 +0000 |
| Subject: | Bug #67320 [Opn]: Ignored sigpipes in php-fpm cause php to become unresponsive | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-238231@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67320&edit=1
ID: 67320
Updated by: bukka@php.net
Reported by: ryan at rmauger dot co dot uk
Summary: Ignored sigpipes in php-fpm cause php to become
unresponsive
Status: Open
Type: Bug
Package: FPM related
Operating System: Linux / Debian 6/7
PHP Version: 5.5.12
-Assigned To:
+Assigned To: bukka
Block user comment: N
Private report: N
New Comment:
Just an update of the links in the bug as this seem to be reported against 5.4:
https://github.com/php/php-src/blob/PHP-5.4/sapi/fpm/fpm/fpm_main.c#L1584
https://github.com/php/php-src/blob/PHP-5.4/sapi/fpm/fpm/fastcgi.c#L316
There's a reason why SIGPIPE is blocked but it might still need a look to see if there is
anything we can do about this issue.
Previous Comments:
------------------------------------------------------------------------
[2021-01-07 21:16:03] iiridayn at skylords dot com
After experiencing the issue for months - this is what's causing my production server to lock
up. Nice to know now.
------------------------------------------------------------------------
[2014-05-21 19:36:55] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67320&edit=1