|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-07-29 14:36 UTC] jr-php2 at quo dot to
[2003-07-30 02:11 UTC] sniper@php.net
[2003-07-30 02:42 UTC] jr-php2 at quo dot to
[2003-08-01 14:51 UTC] jr-php2 at quo dot to
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 22 05:00:01 2025 UTC |
Description: ------------ Apache version: 1.3.28 PHP version: 4.3.2, used as a CGI binary: ./configure --prefix=/usr/local/php-cgi --enable-track-vars --with-mysql --with-zlib --enable-discard-path I have found that if page loading is cancelled by the user (e.g. by closing the Internet Explorer window) before fclose() & proc_close() are called, a zombie process is left behind. Try the code below (save it as 'testx.cgi'). During normal execution, you'll see this: 27551 ? S 0:00 /usr/local/php-cgi/bin/php testx.cgi 22800 ? Z 0:00 [ls <defunct>] If you let the page load completely, both processes go away from the process list. If, however, you close the browser window before the sleep() call finishes, about 70% of the time a zombie process is left behind: 27551 ? Z 0:00 [testx.cgi <defunct>] I have to restart Apache (1.3.28) to kill this process. Reproduce code: --------------- #!/usr/local/php-cgi/bin/php <?php $descriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a pipe that the child will write to 2 => array("file", "/dev/null", "a"), // stderr is a file to write to ); $process = proc_open('/bin/ls -al /tmp', $descriptorspec, $pipes); if (!is_resource($process)) die("Error: proc_open failed"); sleep(10); fclose($pipes[0]); fpassthru($pipes[1]); fclose($pipes[1]); proc_close($process); ?> Expected result: ---------------- There should be no zombie process left over when the user cancels the page load.