Bug #53085 [NEW]: Php blocked waiting process exit

From: Date: Sat, 16 Oct 2010 21:49:17 +0000
Subject: Bug #53085 [NEW]: Php blocked waiting process exit
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155262@lists.php.net to get a copy of this message
From:             
Operating system: Linux
PHP version:      5.2.14
Package:          Program Execution
Bug Type:         Bug
Bug description:Php blocked waiting process exit

Description:
------------
PHP process do not quit.
By some way it is waiting the process created by proc_open to close.
Sending a Ctrl-C send a signal to PHP process and both die.

If I launch it as a background process( appending to command & ) it return
the wrong pid( maybe the parent pid of something that proc_open called )
but PHP do not lock.
The process PID of executable is the pid + 1 returned.
THe problem is that this PID + 1 remains alive.

The option bypass_shell is documented for windows only.
Expect this not to be a duplicated bug or bad interpretation of function
instructions manual.

Test script:
---------------
<?php
define( 'LF', "\n" );
$statusI = 0;

$processIO = array(
       0 => array( 'pipe', 'r' ) # client process will read from it. This
process will write to it #
      ,1 => array( 'pipe', 'w' )
      ,2 => array( 'pipe', 'w' )
    );
$procPipes = array();
#$processIO = array();
$proc = proc_open( '/bin/netstat -ic ', $processIO, $procPipes, getcwd(),
null, array( 'bypass_shell' => true, 'binary_pipes' => true ) );

#var_dump( $procPipes );

#/*
if ( !$statusI )
{
      $status = proc_get_status( $proc );
      if ( !$status['running'] )
        $statusI = $status['exitcode'];
}
#*/
print( LF.'PHP ps pid: '.posix_getpid() );
print( LF.'Child ps pid: '.$status['pid'] );

#/*
fclose( $procPipes[0] );
fclose( $procPipes[1] );
fclose( $procPipes[2] ); 
#*/
#var_dump( __LINE__, proc_close( $proc ) );
$procPipes = null;
$proc = null;

exit( LF.'PHP dying.' );
?>

Expected result:
----------------
Expected that PHP launchs another separated process do his own tasks and
exit leaving the other process alive.

Appending the & to the command unblock but returns the wrong pid.

Actual result:
--------------
Got a blocked PHP process. Example:

PHP ps pid: 13658
Child ps pid: 13659 ( blocked here ).

ps -o pid,ppid,cmd,stat 13659
PID  PPID CMD                         STAT
13659 13658 /bin/netstat -ic            S+

Terminating PHP pid finish the other process too.

With & at end. Example:

PHP ps pid: 13724
Child ps pid: 13725
PHP dying.

ps -o pid,ppid,cmd,stat 13725
PID  PPID CMD                         STAT

ps -o pid,ppid,cmd,stat 13726 ( process 1 init as parent )
PID  PPID CMD                         STAT
13726     1 /bin/netstat -ic            S


-- 
Edit bug report at http://bugs.php.net/bug.php?id=53085&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=53085&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=53085&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=53085&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=53085&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53085&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=53085&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=53085&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=53085&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=53085&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=53085&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=53085&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=53085&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=53085&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=53085&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53085&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53085&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=53085&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=53085&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=53085&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=53085&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=53085&r=mysqlcfg



Thread (1 message)

  • sumariva at gmail dot com
« previous php.bugs (#155262) next »