Skip to content

Restore Windows exit delay and setBlocking workarounds#138

Closed
silverwind wants to merge 3 commits into
masterfrom
fix-node24-windows-dispatcher
Closed

Restore Windows exit delay and setBlocking workarounds#138
silverwind wants to merge 3 commits into
masterfrom
fix-node24-windows-dispatcher

Conversation

@silverwind
Copy link
Copy Markdown
Owner

@silverwind silverwind commented May 10, 2026

The Symbol-based dispatcher.close() approach relied on a private Node API and didn't reliably fix the Node 24 Windows flake. Going back to the straightforward 200ms-on-Windows delay (up from the original 50ms — community minimum is 100ms+, doubled for headroom) and the stdio setBlocking workaround — honest about the upstream Node bug, no reaching into internals.

Refs nodejs/node#56645


This PR was written with the help of Claude Opus 4.7

Aborting the prewarms isn't enough — the keep-alive socket pool still
has idle handles that race during natural shutdown on Windows + Node 24
(nodejs/node#56645). Closing the global dispatcher drains the pool
cleanly, eliminating the race.

Node exposes the global dispatcher via Symbol.for("undici.globalDispatcher.1");
this is the same mechanism undici itself uses to share it with the
runtime.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
@silverwind
Copy link
Copy Markdown
Owner Author

Switching to a simpler workaround approach — see follow-up.

@silverwind silverwind closed this May 10, 2026
@silverwind silverwind reopened this May 10, 2026
The Symbol-based dispatcher.close workaround relied on a private Node API
and didn't reliably fix the Node 24 Windows flake. Restoring the
straightforward 100ms-on-Windows delay and the stdio setBlocking
workaround is honest about the upstream Node bug and avoids reaching
into internals.

Refs nodejs/node#56645

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
@silverwind silverwind changed the title Drain undici dispatcher before exit to fix Node 24 Windows race Restore Windows exit delay and setBlocking workarounds May 10, 2026
Refs nodejs/node#56645

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
@silverwind
Copy link
Copy Markdown
Owner Author

Reverted #137 on master instead. See nodejs/node#56645 — this can only be fixed in Node itself.

@silverwind silverwind closed this May 10, 2026
@silverwind silverwind deleted the fix-node24-windows-dispatcher branch May 10, 2026 22:44
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