mise/dev-all: kill reparented service processes on cleanup#4704
Draft
mise/dev-all: kill reparented service processes on cleanup#4704
Conversation
mise's task supervisor reparents long-running task scripts (the
`mise-tasks/services/*` scripts and the worker's `ts-node --transpileOnly
worker` child) to init, so the existing PPID-based `kill_tree` can't
reach them when dev-all's trap fires on Ctrl-C / EXIT. Result: services
keep running after the parent exits, worker-manager keeps port 4210
bound, and the next `mise dev-all` fails to start because the port is
held.
Adds a `pkill -TERM` sweep scoped to absolute paths under this
checkout's `$REPO_ROOT` (so other worktrees aren't touched), a 2s grace
window, then `pkill -KILL` for anything that didn't respond to TERM.
Patterns:
- `$REPO_ROOT/mise-tasks/services/` (realm-server, worker,
prerender, prerender-mgr,
etc.)
- `$REPO_ROOT/packages/realm-server/node_modules.*--transpileOnly worker`
Diagnostic `tee -a /tmp/dev-all-cleanup.log` lines are WIP — kept for
this draft so cleanup behavior is observable; should be stripped before
merge unless we want a permanent log.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
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.
Summary
mise dev-allwas leaving service processes running after Ctrl-C / exit, most visibly the worker-manager holding port 4210 — which then blocks the nextmise dev-allfrom starting.Root cause: mise's task supervisor reparents long-running task scripts (
mise-tasks/services/*and thets-node --transpileOnly workerchild) to init, so the existing PPID-basedkill_treecan't reach them from dev-all's trap.Fix: a
pkillsweep scoped to absolute paths under this checkout's$REPO_ROOTso other worktrees aren't disturbed. SIGTERM first, 2s grace window, then SIGKILL for anything that didn't respond.Patterns matched:
$REPO_ROOT/mise-tasks/services/(realm-server, worker, prerender, prerender-mgr, etc.)$REPO_ROOT/packages/realm-server/node_modules.*--transpileOnly workerThe PR also adds
tee -a /tmp/dev-all-cleanup.loglines around each step so the cleanup sequence is observable. These are WIP debugging output — should be stripped before merge unless we want a permanent log file. Specifically, the[dev-all cleanup] ...echo statements and thepgrep -lf ...enumeration lines.Test plan
mise dev-all→ wait for stack to come upmise-tasks/services/*processes remain (pgrep -lf "$REPO_ROOT/mise-tasks/services/"returns nothing)lsof -nP -i :4210returns nothingmise dev-allagain — should start cleanly without "address already in use"$REPO_ROOT-scoped patterns shouldn't match them)🤖 Generated with Claude Code