Skip to content

chore Kill orphaned watch processes on shutdown to fix wedged debug launches#825

Open
chrisdp wants to merge 1 commit into
masterfrom
fix/watch-all-orphan-cleanup
Open

chore Kill orphaned watch processes on shutdown to fix wedged debug launches#825
chrisdp wants to merge 1 commit into
masterfrom
fix/watch-all-orphan-cleanup

Conversation

@chrisdp

@chrisdp chrisdp commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

When the Extension Development Host is relaunched, watch-all left its npmtsc/vite subtree running because only the ts-node parent was terminated. Those orphaned watchers piled up across launches, fighting over dist/ and the debug host until a window reload or full restart was needed.

  • watch-all now spawns each watcher in its own process group and kills the whole subtree on SIGINT/SIGTERM/SIGHUP/exit.
  • On startup it cleans up watchers recorded by a previous run that exited ungracefully (via a per-checkout pid file), which breaks the accumulation cycle.
  • Added a cross-platform reset-dev task to clear stale watchers and dev ext-host windows when a launch still gets stuck.
  • Added scripts/tsconfig.json so the editor type-checks the scripts/ dir (clears the debounce/deferred/down-level-iteration errors); removed a dead local and an unused import that surfaced.

watch-all now spawns each watcher in its own process group and kills the whole
npm/tsc/vite subtree on shutdown, and cleans up watchers left by a previous run
that exited ungracefully. Adds a cross-platform reset-dev recovery task and a
scripts/tsconfig.json so the editor type-checks the scripts dir.

@TwitchBronBron TwitchBronBron left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not totally convinced this is the problem, and i'm not loving the processId concept in general. Let's troubleshoot a few times where you run just the task to prove out that it solves the problem.

Comment thread scripts/watch-all.ts
);
const watchers: ChildProcess[] = [];

function killGroup(pid: number) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's harden this slightly, to ensure we don't just kill any arbitrary process with that id. (maybe store PID and process name) and compare them before doing the kill.

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.

2 participants