#36427 [Ver]: proc_open() / proc_close() leak handles on Windows XP

From: Date: Tue, 21 Feb 2006 17:11:59 +0000
Subject: #36427 [Ver]: proc_open() / proc_close() leak handles on Windows XP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-93487@lists.php.net to get a copy of this message
 ID:               36427
 User updated by:  pgj at ds-fr dot com
 Reported By:      pgj at ds-fr dot com
 Status:           Verified
 Bug Type:         Program Execution
 Operating System: windows XP SP2 Windows 2000 SP4
-PHP Version:      4.4.2
+PHP Version:      4.4.2/5.1.2
 New Comment:

Same problem with php 5.1.2


Previous Comments:
------------------------------------------------------------------------

[2006-02-19 01:38:59] nlopess@php.net

While I can reproduce the problem, I couldn't spot the error at first
sight, because the code is very complex (and without valgrind even
worst..)

------------------------------------------------------------------------

[2006-02-17 15:35:06] pgj at ds-fr dot com

Description:
------------
I launch processes in a script and put stout in file
after more than 2000 processes and can't open a new one and have this
message.
It's similar with 30743 bit it uses 2 pipes for $fileDescriptors and in
this case it's a pipe and a file 


Reproduce code:
---------------
<?
set_time_limit(6000);
$i=0;
mkdir(test);
while(1)
{
  $i++;
	echo("-$i--\n");
	invoke($i);
}
function invoke($i)
{
	$commandLine = "echo hello";
	$fileDescriptors = array(
		1 => array("pipe", "r"),
		2 => array("file", "test/$i.txt","w")
		);
	$pipes = array();
	$processHandle	= proc_open($commandLine,$fileDescriptors, $pipes);
	if (is_resource($processHandle))
	{
  	fclose($pipes[1]);
    proc_close($processHandle);
	}
}



Expected result:
----------------
Open a new one

Actual result:
--------------
<b>Warning</b>:  proc_open(test/2587.txt): failed to open stream: Too
many open files in <b>E:\cotcot\leak.php</b> on line <b>24</b><br />


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36427&edit=1


Thread (8 messages)

« previous php.bugs (#93487) next »