ID: 50011 Updated by: [email protected] Reported By: mathew at eisbox dot net -Status: Open +Status: Bogus Bug Type: Reproducible crash Operating System: Ubuntu PHP Version: 5.2.11 New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. You have to make sure to properly detach from the parent. When running from the shell your script will still be attached to the shell so PHP can finish. See your system's nohup(1) manpage. Please ask further questions at a support place. Previous Comments: ------------------------------------------------------------------------ [2009-10-27 07:53:33] mathew at eisbox dot net Description: ------------ The attached bash script, when called via shell_exec, exec, and friends, reproducibly locks apache2 mpm and PHP. (Standard package from Ubuntu). ps shows a defunct sh process under apache2, and apache2 is unresponsive until the owning instance of apache2 is killed off. When run from a shell, the script works without problems. (The script is meant to fork and detach, the detached process runs another process as a daemon) This bug sounds similar to #44994, although this case is Linux, and closing the session does not solve the problem. So I opened a new bug. Reproduce code: --------------- # This is a simplified version of a script designed to reproduce the problem. #!/bin/bash DMNPATH=/path/to/dmn # Path to dmn DMNARGS="-arga -argb" # Args to dmn PIDFILE=/path/to/pid # keepalive pidfile # Setup the keepalive (must be a function to fork) function rundmn { DMNPATH=$1 DMNARGS=$2 # Close stdin/stdout/stderr 0<&-; 1>&-; 2>&- eval "$DMNPATH $DMNARGS" } # Check to see if we are already running if [ -r $PIDFILE ] ; then kill -0 `cat $PIDFILE` > /dev/null 2>&1 if [ $? -eq 0 ] ; then exit; fi fi # fork the rundmn func, save its PID, and detatch rundmn "$DMNPATH" "$DMNARGS" & PID=$!; echo $PID > $PIDFILE disown $PID Expected result: ---------------- I expect a call to exec to run the above bash script, which should return control almost immediately to the PHP script, continuing execution of the PHP script. Actual result: -------------- When run from PHP's exec, the bash script is behaving as expected, and executes to completion as expected. (I have verified execution to a point beyond the last disown command) However, no PHP code beyond the exec is run, and apache2 appears locked. I am uncertain how to proceed beyond this point. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50011&edit=1
