From: e-t172 at e-t172 dot net
Operating system: Linux
PHP version: 5.0.5
PHP Bug Type: Program Execution
Bug description: proc_close() hangs when used with two processes
Description:
------------
(i am french, sorry for my bad english)
1. Open two processes with proc_open()
2. Try to close them : it works only if you close the second one first,
otherwise it hangs
Reproduce code:
---------------
<?php
echo('Opening process 1'."\n");
$process1 = proc_open('cat', array(0 => array('pipe', 'r'), 1 =>
array('pipe', 'r')), $pipes1);
echo('Opening process 2'."\n");
$process2 = proc_open('cat', array(0 => array('pipe', 'r'), 1 =>
array('pipe', 'r')), $pipes2);
// WORKS :
//echo('Closing process 2'."\n");
//fclose($pipes2[0]); fclose($pipes2[1]); proc_close($process2);
//echo('Closing process 1'."\n");
//fclose($pipes1[0]); fclose($pipes1[1]); proc_close($process1);
// DOESN'T WORK :
echo('Closing process 1'."\n");
fclose($pipes1[0]); fclose($pipes1[1]); proc_close($process1);
echo('Closing process 2'."\n");
fclose($pipes2[0]); fclose($pipes2[1]); proc_close($process2);
?>
Expected result:
----------------
$ php -f test.php
Opening process 1
Opening process 2
Closing process 1
Closing process 2
$
Actual result:
--------------
$ php -f test.php
Opening process 1
Opening process 2
Closing process 1
(HANGS)
--
Edit bug report at http://bugs.php.net/?id=34794&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34794&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34794&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34794&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34794&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34794&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34794&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34794&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34794&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34794&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34794&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34794&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34794&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34794&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34794&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34794&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34794&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34794&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34794&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34794&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34794&r=mysqlcfg