|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-10-27 10:16 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 23 18:00:01 2025 UTC |
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.