Conversation
…mmand The start command ended in `... && nohup bash install-media-stack.sh >/dev/null 2>&1 & echo $! > PIDFILE`. The trailing `&` applies to the whole && list, so: - `rm -f PIDFILE` runs in the background subshell and usually deletes the pid file right after `echo $!` wrote it, so the panel never reports the install as running. - The background subshell keeps shell_exec's stdout pipe open until the installer exits, so the Start request blocks for the whole install and dies with a 502 when the installer restarts lighttpd/php-cgi at the end. Group the backgrounded installer with the pid write and detach its stdin. Test: a fake installer sleeping 3s; the launch must return at once and leave a pid file naming the running process (fails on the old command after 3.01s). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug:
pmssMediaStackPanelStartCommandBuild()buildsThe trailing
&backgrounds the whole&&list, not just the installer:rm -f PIDFILEruns inside the background subshell, usually after the foregroundecho $! > PIDFILE, so.install-media-stack-web.pidis gone. The panel never shows the install as running and falls straight to installed once the first app dirs appear.shell_exec's stdout pipe, so the POST waits for the installer to exit. On a successful install the installer restarts lighttpd/php-cgi at the end, and the request dies with HTTP 502.This hasn't been visible because the current installer aborts early at #858 (the POST then returns after ~30 s). With a completing installer (#959 applied) the Start button returns 502.
Reproduced on a Pulsed Media seedbox with the same shell and
sleep 20as the installer:The Start button also returned 502 there after a complete panel-driven install.
Fix: background only the installer, keep the pid write with it, and detach stdin:
Test: new
testStartCommandReturnsAtOnceAndKeepsPidFileruns the real command against a fake installer that sleeps 3 s. The launch must return in < 2 s and the pid file must name a live process. It fails on the old command (3.01s) and passes with the fix.mediaStackPanelTest.php: 25 tests, 0 failures (1 skipped, as before).php -lOK.🤖 Generated with Claude Code