Bug #69014 [Opn->Fbk]: proc_close and proc_get_status returns NULL. Zombies remain in process-list
| From: | joey@php.net | Date: | Tue, 10 Feb 2015 08:03:50 +0000 |
| Subject: | Bug #69014 [Opn->Fbk]: proc_close and proc_get_status returns NULL. Zombies remain in process-list | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-190564@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69014&edit=1
ID: 69014
Updated by: joey@php.net
Reported by: f0o at devilcode dot org
Summary: proc_close and proc_get_status returns NULL. Zombies
remain in process-list
-Status: Open
+Status: Feedback
Type: Bug
Package: Program Execution
Operating System: Gentoo 2.2, Debian Jessie
PHP Version: 5.5.21
Block user comment: N
Private report: N
New Comment:
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
I have been unable to duplicate this bug on Debian Jessie with PHP 5.6.5 (5.6.5+dfsg-1), 5.5.21
built from source, nor 5.5.9 from Ubuntu packages.
Previous Comments:
------------------------------------------------------------------------
[2015-02-08 15:37:17] f0o at devilcode dot org
Description:
------------
'proc_get_status' and 'proc_close' return 'NULL' and leave the process
as defunct/Zombie in the process-list.
The process has no open files and is verified to be terminated in execution.
PHP Versions 5.5.21 and 5.6.5 are affected.
PHP Versions 5.4.37 is NOT affected.
The bug was noticed under Gentoo 2.2 and verified under Debian Jessie.
Gentoo has been used to isolate the affected versions as it guarantees an equal build-environment
for all php-installations and allows to 'hotswap' the versions at any given time.
All tests have been conducted with PHP-FPM under Nginx.
Version of Nginx has no influence on the bug.
Test script:
---------------
<?php
function pipe_open(&$process, &$pipes) {
$command = "/bin/date +%s";
$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("pipe", "w") // stderr is a pipe that the child will write
to
);
$cwd = '/';
$env = array();
$process = proc_open($command, $descriptorspec, $pipes, $cwd, $env);
var_dump("Proc:");
var_dump($process);
var_dump("Status:");
var_dump(proc_get_status($process));
stream_set_blocking($pipes[1], 0);
stream_set_blocking($pipes[2], 0);
if( is_resource($process) ) {
return true;
}
}
function pipe_close($process, &$pipes) {
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
var_dump("Status:");
var_dump(proc_get_status($process));
$return_value = proc_close($process);
var_dump("RetVal:");
var_dump($return_value);
var_dump("Proc:");
var_dump($process);
return $return_value;
}
function test($param) {
pipe_open($process, $pipes);
if( is_resource($process) ) {
fwrite($pipes[0], $param);
fclose($pipes[0]);
while( strlen($line) < 1 ) {
$line = fgets($pipes[1],1024);
$data .= $line;
}
$return_value = pipe_close($process, $pipes);
return $data;
} else {
return 0;
}
}
var_dump(test(""));
?>
Expected result:
----------------
string(5) "Proc:"
resource(5) of type (process)
string(7) "Status:"
array(8) {
["command"]=>
string(13) "/bin/date +%s"
["pid"]=>
int(30731)
["running"]=>
bool(true)
["signaled"]=>
bool(false)
["stopped"]=>
bool(false)
["exitcode"]=>
int(-1)
["termsig"]=>
int(0)
["stopsig"]=>
int(0)
}
string(7) "Status:"
array(8) {
["command"]=>
string(13) "/bin/date +%s"
["pid"]=>
int(30731)
["running"]=>
bool(true)
["signaled"]=>
bool(false)
["stopped"]=>
bool(false)
["exitcode"]=>
int(-1)
["termsig"]=>
int(0)
["stopsig"]=>
int(0)
}
string(7) "RetVal:"
int(0)
string(5) "Proc:"
resource(5) of type (Unknown)
string(11) "1423408318
"
Actual result:
--------------
string(5) "Proc:"
resource(5) of type (process)
string(7) "Status:"
NULL
string(7) "Status:"
NULL
string(7) "RetVal:"
NULL
string(5) "Proc:"
resource(5) of type (process)
string(11) "1423408318
"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69014&edit=1