#34794 [Fbk->Opn]: proc_close() hangs when used with two processes
| From: | e-t172 at e-t172 dot net | Date: | Sun, 09 Oct 2005 18:12:10 +0000 |
| Subject: | #34794 [Fbk->Opn]: proc_close() hangs when used with two processes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-86284@lists.php.net to get a copy of this message | ||
ID: 34794
User updated by: e-t172 at e-t172 dot net
Reported By: e-t172 at e-t172 dot net
-Status: Feedback
+Status: Open
Bug Type: Program Execution
Operating System: Linux
-PHP Version: 5.0.5
+PHP Version: 5.0.5 & CVS 200510091630
New Comment:
Same problem with the last CVS Snapshot.
Previous Comments:
------------------------------------------------------------------------
[2005-10-09 19:15:21] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
[2005-10-09 18:23:40] e-t172 at e-t172 dot net
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 this bug report at http://bugs.php.net/?id=34794&edit=1