ID:               22999
 Comment by:       vojtech at fotobanka dot cz
 Reported By:      phil at concretecomputing dot co dot uk
 Status:           Assigned
 Bug Type:         Filesystem function related
 Operating System: sun os
 PHP Version:      4.3.1
 Assigned To:      wez
 New Comment:

When using oracle (oci8) without --enable-sigchild, apache threads
sometimes hangs as a defunct process (zombie). On Linux this means the
load is always 1.
This bug is related to 
<a href="http://bugs.php.net/bug.php?id=8992";>#8992</a>,
<a href="http://bugs.php.net/bug.php?id=14182";>#14182</a>,
<a href="http://bugs.php.net/bug.php?id=17538";>#17538</a>.
In all these bugs is stated the problem is fixed but with my
configuration still appears.
Linux 2.4.20, Debian 3.0, Apache 1.3.27, PHP 4.3.2
configured with:
'./configure' \
'--with-apxs' \
'--disable-debug' \
'--enable-track-vars' \
'--enable-sysvsgm' \
'--enable-sysvshm' \
'--enable-sysvsem' \
'--with-zlib' \
'--with-bz2' \
'--with-gd' \
'--with-iconv' \
'--with-oci8' \
'--enable-sigchild' \
"$@"


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

[2003-04-17 13:37:25] michael at six dot de

We have the same issue with pclose()

Testcase:

<?php
$fp = popen("ls","r");
if ($fp) {
        while(! feof($fp)) {
                fgets($fp,1024);
        }
        $status = pclose($fp);
        print "pclose: status=$status\n";
}
?>

Most of the time $status is -1, sometimes 0.
PHP-4.3.2RC1, Solaris 7, --enable-sigchild

PHP is compiled with --enable-sigchild because the oracle client is
needed too, this was recommended in former bug descriptions. Is this
still the case for oracle?

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

[2003-04-01 05:00:37] [EMAIL PROTECTED]

This is a known issue when compiling with
--enable-sigchild.

I will see if it can be fixed.

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

[2003-04-01 04:17:36] phil at concretecomputing dot co dot uk

I'm trying to run a command via proc_open(). The command always
succeeds (exits with status of 0), so I would expect that proc_close()
would always return 0. Most of the time it does, but sometimes it
returns -1.

Here is a script which reproduces the problem. On my system, if you run
the script many times, most times the status reported will be 0, but
occasionally it will be -1.

<?

$inputArray = 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("pipe", "w")                             // stderr is a
pipe that the child will write to
);

$process = proc_open("ps -ef", $inputArray, $outputArray);             
  

if (is_resource($process)) {

  fclose($outputArray[0]);

  // Grab the output
  $output="";
  while(!feof($outputArray[1])) {
    $output .= fgets($outputArray[1], 1024);       
  }

  // Extract any error output
  $errorOutput = "";
  while(!feof($outputArray[2])) {
    $errorOutput .= fgets($outputArray[2], 1024);
  }

  // It is important that you close any pipes before calling
proc_close() in order to avoid a deadlock
  fclose($outputArray[1]);
  fclose($outputArray[2]);

  $status = proc_close($process);    

  echo "proc_close() return result: $status<br>\n";            
  echo "ps error output: [$errorOutput]<br>\n";
  echo "ps output: [$output]<br>\n";                 
}

echo "Done<br>\n";

?>


PHP is compiled as follows:

'./configure' '--with-apxs=/usr/local/apache1.3.27-nerens3.4/bin/apxs'
'--without-mysql' '--enable-track-vars' '--enable-sigchild'
'--with-oci8=/opt/oracle/product/9.0.1' '--enable-apc' '--with-xml'
'--with-expat-dir=/usr/local/expat' '--with-zlib=/usr/local/zlib'
'--with-curl=/usr/local/curl' '--with-mhash=/usr/local/mhash'
'--with-mcrypt=/usr/local/libmcrypt' 

I have tried to have a look at what is going on using truss and I think
it may be caused by another function within php doing a wait() and
getting the exit status for the child so that the wait() in proc_close
returns with ECHLD.

While testing using the above script, I have found that if I add a call
to sleep after the proc_open() call then proc_close() _always_ returns
-1 (and the sleep() call has no effect)

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


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

Reply via email to