#40286 [Opn]: PHP fastcgi with PHP_FCGI_CHILDREN don't kill children when parent is killed

From: Date: Wed, 31 Jan 2007 11:56:50 +0000
Subject: #40286 [Opn]: PHP fastcgi with PHP_FCGI_CHILDREN don't kill children when parent is killed
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-108274@lists.php.net to get a copy of this message
ID: 40286 User updated by: gabriel at oxeva dot fr Reported By: gabriel at oxeva dot fr Status: Open Bug Type: CGI related Operating System: Linux 2.6 PHP Version: 4.4.4 Assigned To: dmitry New Comment: And today, I can now confirm that the bugs exists with PHP 5.2.0 too. Here is the backtrace : (gdb) bt #0 0xb7fb2410 in ?? () #1 0xbfc06988 in ?? () #2 0x00000008 in ?? () #3 0xbfc069b0 in ?? () #4 0x006ee4f3 in __read_nocancel () from /lib/tls/libc.so.6 #5 0x0841b6d4 in fcgi_init_request () #6 0x0841b770 in fcgi_read () #7 0x0841c546 in fcgi_putenv () #8 0x08382d33 in sapi_deactivate () #9 0x0837c4f6 in php_request_shutdown () #10 0x0841e463 in main () Previous Comments: ------------------------------------------------------------------------ [2007-01-30 14:33:38] gabriel at oxeva dot fr Forgot to mention that the backtrace provided is from a PHP 5.1.4 process, not php 5.2. Sorry for the misreading. I can compile and run a PHP 5.2 process and wait for having one killed without his children, but it will take some time to give you the results. ------------------------------------------------------------------------ [2007-01-30 14:27:52] gabriel at oxeva dot fr Missed to say that PHP 5 has exactly the same problem ------------------------------------------------------------------------ [2007-01-30 14:26:42] gabriel at oxeva dot fr strace -p <PID> provides the following : read(3, <unfinished ...> and gdb program <PID> and "bt" provides : (gdb) bt #0 0xb7fe3410 in ?? () #1 0xbfd86618 in ?? () #2 0x00000008 in ?? () #3 0xbfd86600 in ?? () #4 0x008e14f3 in __read_nocancel () from /lib/tls/libc.so.6 #5 0x083ba23e in fcgi_read () #6 0x083bbb38 in FCGX_FPrintF () #7 0x0831ab22 in sapi_deactivate () #8 0x08314a3d in php_request_shutdown () #9 0x083bcdeb in main () Please note that I can't test with debugging symbols (the libraries and PHP are stripped), as this binary is in production environment and the bug occurs only under load. ------------------------------------------------------------------------ [2007-01-30 13:20:40] dmitry@php.net Could you plase attach debugger to non-killed process and provide backtrace. Do php-5.2 has the same problem? ------------------------------------------------------------------------ [2007-01-30 11:50:52] gabriel at oxeva dot fr In all the report, I mean killed is kill with signal 15 (TERM). As stated in the report, children are blocking in a syscall, which means they can only be killed by signal 9 (KILL). The fastcgi_cleanup function registered on shutdown kills with TERM signal 15. I think the bug occurs when children, under load, are executing a syscall when the parent is killed and start the fastcgi_cleanup. A fast workaround would be to kill children with signal 9 in the fastcgi_cleanup, at sapi/cgi/cgi_main.c:951. ------------------------------------------------------------------------ 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 http://bugs.php.net/40286 -- Edit this bug report at http://bugs.php.net/?id=40286&edit=1

« previous php.bugs (#108274) next »