Skip to content

fix(server): stopping a Node.js install waits until its check has really exited - #732

Merged
badcuban merged 1 commit into
mainfrom
fix/node-check-stop-waits
Oct 31, 2026
Merged

badcuban merged 1 commit into
mainfrom
fix/node-check-stop-waits

Conversation

@badcuban

Copy link
Copy Markdown
Collaborator

ManagedNode.test.ts › "an install stopped while Node is being checked leaves no process and no files" failed now and then on CI (seen in #731's merge queue run): process.kill(pid, 0) still found the process right after the install was stopped.

Why. runOnce settled on execFile's callback. On an abort, Node sends the kill signal and raises the AbortError right away, before the process exits. A standalone probe on Node 22 hit this 20 out of 20 times. So a stopped install moved on to deleting the folder the check runs from while the process was still there; on Windows that delete fails while it runs. Usually the process was reaped a moment later, which is why the test mostly passed.

Fix. runOnce now settles only after the child's exit (or right away when it never started and has no pid). A check that ignores the stop is killed with SIGKILL after STOP_GRACE_MS (2 s), so stopping can't hang. The test's fake node now ignores SIGTERM, so the old code fails it every time (checked) and the fix passes it.

Checks: vp fmt, vp lint, vp run typecheck; ManagedNode tests three runs in a row.

…lly exited

Stopping an install while it ran the downloaded `node --version` check
returned as soon as the stop signal was sent: execFile answers an abort
right away, before the process exits. The install then went on to delete
the folder that process runs from (on Windows that fails while it runs),
and the test for this, which checks the process is gone, failed now and
then on CI.

runOnce now settles only once the program has exited, and a program that
ignores the stop is killed outright after two seconds so a stop can't hang.
The test's fake node now ignores the polite stop, so the old code fails it
every time instead of rarely.
@vercel

vercel Bot commented Oct 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
threadlines Skipped Skipped Oct 31, 2026 7:12am UTC

Request Review

@badcuban
badcuban added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit 289a1ff Oct 31, 2026
31 of 33 checks passed
@badcuban
badcuban deleted the fix/node-check-stop-waits branch October 31, 2026 07:38

This branch was previously deployed

1 inactive deployment
Preview — 41c5ec90 Deployed Oct 31, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant