stream: avoid retrying accepted pipeTo writes#63297
Open
trivikr wants to merge 1 commit into
Open
Conversation
PushWriter in block backpressure mode can return false from writeSync() and writevSync() after accepting data. Treat that false return as backpressure and wait for drain instead of retrying the same chunks asynchronously. Fixes: nodejs#63296 Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: openai:gpt-5.5
Collaborator
|
Review requested:
|
jasnell
approved these changes
May 14, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #63297 +/- ##
=======================================
Coverage 90.05% 90.05%
=======================================
Files 714 714
Lines 225247 225289 +42
Branches 42578 42594 +16
=======================================
+ Hits 202842 202891 +49
+ Misses 14181 14175 -6
+ Partials 8224 8223 -1
🚀 New features to boost your workflow:
|
Collaborator
Collaborator
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.
pipeTo()treatedwriteSync()/writevSync()returningfalseas afailed sync write and retried the same chunk(s) through the async path.
That is incorrect for
PushWriterwithbackpressure: 'block', wherefalsemeans the data was accepted but the writer is now backpressured. Thiscaused duplicated output such as
abcdcdinstead ofabcd, andabbbinstead of
ab.This updates
pipeTo()to detect that internal writer case and wait for draininstead of retrying accepted data. It also adds regression coverage for both
the single-chunk
writeSync()path and the multi-chunkwritevSync()path.Fixes: #63296
Assisted-by: openai:gpt-5.5