stream: wait for push writer end fallback to drain#63503
Open
trivikr wants to merge 1 commit into
Open
Conversation
Collaborator
|
Review requested:
|
When endSync() returns -1 after buffered writes, a follow-up end() should stay pending until the readable side drains the queued data. Do not make duplex channel close() wait for that drain, since close() only needs to signal EOF to the peer. Waiting there can deadlock when the peer starts reading only after close() resolves. Fixes: nodejs#63502 Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: openai:gpt-5.5
7fa1d26 to
cee2067
Compare
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.
Fixes an issue in
node:stream/iterwherepush()writerend()couldresolve before buffered data was consumed when called after
endSync()returned
-1.endSync()already transitions the queue toclosingwhen data remainsbuffered. A subsequent async
end()now keeps waiting for that closingstate to drain, and reuses any existing pending end promise.
duplex()channel close now only signals EOF synchronously instead ofawaiting that drain, since the peer may not start reading until after
close()resolves.Fixes: #63502
Assisted-by: openai:gpt-5.5