Skip to content

mise/dev-all: kill reparented service processes on cleanup#4704

Draft
lukemelia wants to merge 1 commit intomainfrom
fix/dev-all-cleanup-reparented-services
Draft

mise/dev-all: kill reparented service processes on cleanup#4704
lukemelia wants to merge 1 commit intomainfrom
fix/dev-all-cleanup-reparented-services

Conversation

@lukemelia
Copy link
Copy Markdown
Contributor

Summary

mise dev-all was leaving service processes running after Ctrl-C / exit, most visibly the worker-manager holding port 4210 — which then blocks the next mise dev-all from starting.

Root cause: mise's task supervisor reparents long-running task scripts (mise-tasks/services/* and the ts-node --transpileOnly worker child) to init, so the existing PPID-based kill_tree can't reach them from dev-all's trap.

Fix: a pkill sweep scoped to absolute paths under this checkout's $REPO_ROOT so 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 worker

⚠️ Cleanup before merge

The PR also adds tee -a /tmp/dev-all-cleanup.log lines 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 the pgrep -lf ... enumeration lines.

Test plan

  • mise dev-all → wait for stack to come up
  • Ctrl-C → verify in another shell that no mise-tasks/services/* processes remain (pgrep -lf "$REPO_ROOT/mise-tasks/services/" returns nothing)
  • Verify port 4210 is free: lsof -nP -i :4210 returns nothing
  • mise dev-all again — should start cleanly without "address already in use"
  • Verify other worktrees' running services are untouched (the $REPO_ROOT-scoped patterns shouldn't match them)

🤖 Generated with Claude Code

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>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Host Test Results

    1 files      1 suites   1h 46m 48s ⏱️
2 634 tests 2 619 ✅ 15 💤 0 ❌
2 653 runs  2 638 ✅ 15 💤 0 ❌

Results for commit 5da1b3d.

Realm Server Test Results

    1 files      1 suites   14m 52s ⏱️
1 261 tests 1 261 ✅ 0 💤 0 ❌
1 339 runs  1 339 ✅ 0 💤 0 ❌

Results for commit 5da1b3d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant