Repository navigation
fix(cli): stop what the app started before an oxnode watch restart - #879
Merged
Merged
Conversation
On a restart, oxnode watch sent the kill signal to the app alone and started the next run as soon as the app exited. A server the app had started in a subprocess kept running and held its port (#875). Now the kill effect lists the app's descendants before the signal (once the app exits they move to PID 1 and cannot be found). When the app exits, the ones still running get the same signal, and the next run starts once they are gone. The kill timeout, Return and a second Ctrl+C force kill them too. Zombies count as gone, and a PID with another start time is another process. After a force kill oxnode waits at most 1 s. Closes #875 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Closes #875
Problem
On a restart,
oxnode watchsent--kill-signalto the app only, and started the next run as soon as the app exited. A server the app started in a normal subprocess kept its port, so the next run gotEADDRINUSE.Fix
killeffect lists the app's descendants (subtree(processTable(), pid)). Once the app exits they move to PID 1 and can't be found by parent any more.childExitwhen they are gone. The reducer is unchanged.--kill-timeout, Return and a second Ctrl+C force kill what is left (killTreenow also takes the known list). After a force kill oxnode waits at most 1 s, then logs the PIDs left and goes on. SIGKILL cannot end a process stuck on a hung mount.processTable()now readsstatandlstartfromps, falling back to the two columns, and the state and start time from/proc/<pid>/stat.taskkill /T), and stopping for exit, apart from a force kill now waiting for what it killed.Not covered (README "Limits")
tsx watchandnode --watchdon't do this either. nodemon waits, but only until the app exits.Tests
watch-cli.spec.ts: the issue's case (a server in a subprocess cleans up, then the next run binds the same port), a server that ignores SIGTERM under--kill-timeout=300, and SIGTERM to oxnode during the wait. All three fail onmain.watch-units.spec.ts:/procstate and start time,pswithstat/lstart,stillRunning(reused PID, zombie, late grandchild), andsignalAll.vp run testandOXC_TRANSFORM_ALL=true vp run testpass (571), as do lint and fmt.🤖 Generated with Claude Code