You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
oxnode watch restart leaves processes the app started running, so a port stays busy #875
On a restart, oxnode watch sends the kill signal (SIGTERM) to the app process only. Once the app exits, the watcher clears the kill timer and starts the next run. A process the app started, such as a server in a normal (not detached) subprocess, keeps running, so the next run cannot bind the same port. killTree runs only on the kill timeout, Return, or a second Ctrl+C.
The first run's server (82159) still holds the port after the restart (timestamps removed).
Reproduced on main (4759ced, v1.0.0) with Node.js 22.18 on macOS arm64. Found while embedding the watcher in Vite+ for vpx watch (voidzero-dev/vite-plus#3164). tsx watch 4.23.15 and node --watch behave the same way.
Cause
The kill effect signals the child alone, and its exit handler dispatches childExit right away (command.ts L213-L233).
On childExit while stopping for a restart, the machine clears the kill timer and spawns the next run (machine.ts L178-L183).
Once the child exits, its descendants are re-parented, so they cannot be found from its PID afterwards either.
Possible fix
List the child's descendants (descendants(processTable(), pid)) when a restart tells it to stop. When the child exits, send the same signal to the ones still running, and start the next run only after they are gone, force killing them on the kill timeout. On Linux, a zombie should count as gone: as PID 1 in a container without an init, oxnode adopts the orphans and never reaps them.
Activity
feat(vpx): run `vpx --watch` on oxc-node's watcher (#3164)