#32533 [NEW]: proc_get_status() - "running" always returns TRUE, even after process dead

From: Date: Fri, 01 Apr 2005 12:42:15 +0000
Subject: #32533 [NEW]: proc_get_status() - "running" always returns TRUE, even after process dead
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-76164@lists.php.net to get a copy of this message
From: chris at fragzzhost dot com Operating system: Linux 2.6.8 PHP version: 5.0.4 PHP Bug Type: Program Execution Bug description: proc_get_status() - "running" always returns TRUE, even after process dead Description: ------------ In the 5.0.4 release of PHP, the original proc_get_status bug (32210) doesn't appear to be fixed (Linux babe.fragzzhost.com 2.6.8.1 #1 SMP Tue Oct 12 08:27:04 CEST 2004 i686 i686 i386 GNU/Linux). The "running" field now is always TRUE. I know absolutely nothing about how this bit of code works, but I made the following change and it was fixed. Hopefully someone understands how this fluke works :) Original code (note not as posted code) if (WIFSTOPPED(wstatus)) { stopped = 1; stopsig = WSTOPSIG(wstatus); } } else { running = 0; } #endif My dreadful change: if (WIFSTOPPED(wstatus)) { stopped = 1; stopsig = WSTOPSIG(wstatus); } } else { running = 1; } #endif I would also like to add that the original patch below doesn't appear to work correctly? Immediately after I kill the process manually with kill -9, running is FALSE as expected, but then if I sleep(2) then call proc_get_status() again, running is TRUE, and the process described isn't running. Reproduce code: --------------- (Best run from the command line) $handle = proc_open("sleep 60", array(2 => array("pipe", "r")), $pipes); $status = proc_get_status($handle); var_dump($status["running"]); sleep(5); (confirmed at this stage that process is still running by 'ps aux') system('kill -9 '.$status['pid']); sleep(2); $status = proc_get_status($handle); var_dump($status["running"]); Expected result: ---------------- bool(false) bool(false) -- Edit bug report at http://bugs.php.net/?id=32533&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32533&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32533&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32533&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32533&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32533&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32533&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32533&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32533&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32533&r=support Expected behavior: http://bugs.php.net/fix.php?id=32533&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32533&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32533&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32533&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32533&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32533&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32533&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32533&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32533&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32533&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32533&r=mysqlcfg

« previous php.bugs (#76164) next »