stream: align Readable.toWeb termination with eos - #62394
Merged
Merged
Conversation
Collaborator
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62394 +/- ##
==========================================
- Coverage 89.69% 89.69% -0.01%
==========================================
Files 676 676
Lines 206693 206767 +74
Branches 39577 39588 +11
==========================================
+ Hits 185402 185457 +55
- Misses 13435 13442 +7
- Partials 7856 7868 +12
🚀 New features to boost your workflow:
|
MattiasBuelens
approved these changes
Mar 23, 2026
jasnell
approved these changes
Mar 23, 2026
ikeyan
force-pushed
the
fix-stream-readable-to-web
branch
from
March 24, 2026 02:11
b9b8a96 to
a0fd4b7
Compare
Contributor
Author
|
Nothing to do now. Ready to merge. |
MattiasBuelens
approved these changes
Mar 25, 2026
Collaborator
Collaborator
Collaborator
Collaborator
Contributor
|
Landed in 783b382 |
aduh95
pushed a commit
that referenced
this pull request
May 22, 2026
PR-URL: #62394 Reviewed-By: Mattias Buelens <mattias@buelens.com> Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95
pushed a commit
to aduh95/node
that referenced
this pull request
Jul 30, 2026
PR-URL: nodejs#62394 Reviewed-By: Mattias Buelens <mattias@buelens.com> Reviewed-By: James M Snell <jasnell@gmail.com>
9 tasks
jasnell
added a commit
to cloudflare/workerd
that referenced
this pull request
Sep 14, 2026
newReadableStreamFromStreamReadable watched its source with a plain
eos(stream, cb), which for a Duplex settles only once both sides are
done. The readable half of Duplex.toWeb() (and Readable.toWeb() over any
Duplex) therefore never reported done for a source whose readable side
had ended while its writable side stayed open: a read() issued after the
EOF hung until the writer was closed, which for a half-open socket whose
peer has sent FIN may never happen. Watch with { writable: false }, as
upstream does since v26.3.0 (nodejs/node#62394), so the ReadableStream
mirrors the readable side only. The writable half keeps watching the
whole Duplex, so writer.close() still settles after the readable side
has ended, matching upstream's Writable.toWeb.
The suite's pin of the old coupling is replaced by one asserting that
the EOF read resolves while the writable side is open and that the
writable half keeps working afterwards.
Compatibility: no flag. The only observable change is that a read()
which previously stayed pending until the writable side finished now
resolves with done; no read that previously settled changes its result,
and non-Duplex sources are unaffected since the option is a no-op for a
stream with no writable side.
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.
This aligns
Readable.toWeb(stream)termination handling witheos(stream, { writable: false }).Changes:
end(),destroy(), anddestroy(error)Readableadapter state, including closed/errorstate and byte stream type, regardless of when the adapter is created
Readable.toWeb()reuseeos()immediate completion handlingfor already-terminated streams
path, including listener cleanup and BYOB termination
Tests: