Bug #67320 [Asn->Csd]: Ignored sigpipes in php-fpm cause php to become unresponsive

From: Date: Sun, 03 Dec 2023 22:46:25 +0000
Subject: Bug #67320 [Asn->Csd]: Ignored sigpipes in php-fpm cause php to become unresponsive
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245969@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: Assigned +Status: Closed Type: Bug Package: FPM related Operating System: Linux / Debian 6/7 PHP Version: 5.5.12 Assigned To: bukka Block user comment: N Private report: N New Comment: I just had a look on this one and it seems to me like another issue that got fixed during PHP 7 (don't remember exact version) but should be fixed in PHP 8. I don't think blocking SIGPIPE was the reason for this and it wouldn't really make much sense to me why it should. I will close this but in case you still experience an issue in PHP 8.2+, please open a new GitHub issue and we will deal with that. Previous Comments: ------------------------------------------------------------------------ [2021-12-06 23:12:07] bukka@php.net 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. ------------------------------------------------------------------------ [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

« previous php.bugs (#245969) next »