fix: drain outbound connections during shutdown - #3594
Closed
GrapeBaBa wants to merge 5 commits into
Closed
Conversation
…-dial-drain # Conflicts: # packages/transport-tcp/src/tcp.ts # packages/transport-tcp/test/listen-dial.spec.ts
Contributor
Author
|
Superseded by #3596, whose head points exactly to the source used by the running 50-cycle Lodestar validation image. |
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.
Description
Prevent shutdown from finishing while outbound dial jobs or TCP sockets still own referenced native handles.
This was observed while investigating a Lodestar shutdown hang: https://gist.github.com/nflaig/5f41cfc50f38baf5046a034162943dc3
A real failure left a Node.js worker in Environment::CleanupHandles with an inactive but referenced TCP handle. A minimal Node.js reproduction using socket.end followed by socket.resetAndDestroy also hangs with reset EINVAL, while closing the same socket with socket.destroy exits normally.
Verification
Notes & open questions
The reset guard preserves resetAndDestroy for ordinary aborts. It uses destroy only when writableEnded shows that graceful shutdown has already begun and a TCP reset can no longer be requested safely.
Change checklist