Drop process.exit() to let Node shut down naturally#137
Merged
Conversation
The 50ms Windows workaround for nodejs/node#56645 was insufficient on Node 26: the libuv assertion fires from uv_async_send after uv_close, which the explicit exit() precipitates. Setting process.exitCode and letting the event loop drain avoids the racy shutdown path entirely. Removes the setBlocking() workaround on stdout/stderr too — it was only needed because exit() doesn't flush async writes; natural shutdown does. Re-enables Node 24 and 26 on Windows in CI. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
The fire-and-forget prewarm fetches could still be in flight when main() returns, racing with natural shutdown and triggering the libuv assertion on Node 24 Windows. Tracking them with an AbortController and awaiting their settlement in end() ensures clean shutdown. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
silverwind
added a commit
that referenced
this pull request
May 10, 2026
This reverts commit eea63c9.
silverwind
added a commit
that referenced
this pull request
May 11, 2026
* update deps (silverwind) * Revert "Drop `process.exit()` to let Node shut down naturally (#137)" (silverwind) * Drop `process.exit()` to let Node shut down naturally (#137) (silverwind) * Exclude Node 26 on windows-latest (silverwind) * Update vitest-config-silverwind to 11.3.3, add Node 26 to CI (silverwind) * update deps (silverwind) * Minor perf and simplification cleanups (silverwind)
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.
The 50ms Windows workaround for nodejs/node#56645 was insufficient on Node 26 — the libuv assertion fires from
uv_async_sendafteruv_close, which the explicitexit()precipitates. Settingprocess.exitCodeand letting the event loop drain avoids the racy shutdown path entirely.Removes the
setBlocking()workaround on stdout/stderr too — it was only needed becauseexit()doesn't flush async writes; natural shutdown does.Re-enables Node 24 and 26 on Windows in CI.
This PR was written with the help of Claude Opus 4.7