php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21077 proc_open hangs
Submitted: 2002-12-18 08:49 UTC Modified: 2003-07-16 03:55 UTC
From: msopacua@php.net Assigned:
Status: Closed Package: Program Execution
PHP Version: 4CVS-2003-07-15 (dev) OS: any BSD
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: msopacua@php.net
New email:
PHP Version: OS:

 

 [2002-12-18 08:49 UTC] msopacua@php.net
proc_open test in the testsuite fails.

Seems that proc_close fails now (returns -1).

Patch rev 1.85/1.86 on exec.c and related files triggered the bug.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-18 08:50 UTC] msopacua@php.net
assigning and marking on request
 [2002-12-19 14:36 UTC] wez@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 [2003-02-26 15:56 UTC] jlondon at mail dot mcg dot edu
proc_open hangs on the example that is in the manual.  Here is the code.

$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", "c:/temp/error-output.txt", "a"), // stderr is a file to write to
);
$process = proc_open("c:\php\php.exe", $descriptorspec, $pipes);
if (is_resource($process)) {
    // $pipes now looks like this:
    // 0 => writeable handle connected to child stdin
    // 1 => readable handle connected to child stdout
    // Any error output will be appended to /tmp/error-output.txt

    fwrite($pipes[0], "<?php echo \"Hello World!\"; ?>" . chr(3));
    fclose($pipes[0]);

    while(!feof($pipes[1])) {
        echo fgets($pipes[1], 1024);
    }
    fclose($pipes[1]);
    // It is important that you close any pipes before calling
    // proc_close in order to avoid a deadlock
    $return_value = proc_close($process);

    echo "command returned $return_value\n";
}

I'm running NT4 Server/PHP4.3.2.2/IIS4.  This bit of code opened up 54 php.exe/cmd.exe (that's 54 of each or 108 total) processes on my machine.
 [2003-07-15 09:51 UTC] webmaster at ragnarokonline dot de
It looks like, the bug has returned.

the test hangs on 
TEST_PHP_EXECUTABLE=sapi/cli/php \
sapi/cli/php -n run-tests.php \
ext/standard/tests/file/proc_open01.phpt
 [2003-07-15 12:59 UTC] msopacua@php.net
Confirmed for PHP_4_3 on FreeBSD 4.8-STABLE.

Updating version, reopening.
cvs -DYesterday ext/standard/exec.c shows a rather large commit by moriyoshi, done 2003/07/13, concerning a leak fixer (MFH).

Removing assignment for now.
 [2003-07-15 16:32 UTC] sniper@php.net
Can you confirm whether the commit by Moriyoshi caused this?

 [2003-07-15 18:59 UTC] msopacua@php.net
Nope. 
 
But then again, going back to 1.84.2.3, which contained the 
fix, also doesn't solve the problem. 
 
So, this is not just an ext/standard/exec.c issue, I'm 
afraid. 
 
Attaching with gdb, lands me anywhere from 
zend_parse_parameters to zend_get_opline(), so that's not 
very useful either. 
 
I can try some release tags tommorow to get a more exact 
location of the breaking commit. 
 
Need sleep now :) 
 [2003-07-16 03:55 UTC] msopacua@php.net
1) This test was bogus, fixed by hholzgra in 1.1.2.3 
2) The original test, was 
ext/standard/general_functions/proc_open.phpt 
3) Both are working now. 
 
( 4) Why are these tests in different categories? ) 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC