fix: fix wrong stream canceled up after cloning (v6)#4414
Merged
Uzlopak merged 6 commits intonodejs:v6.xfrom Aug 18, 2025
Merged
fix: fix wrong stream canceled up after cloning (v6)#4414Uzlopak merged 6 commits intonodejs:v6.xfrom
Uzlopak merged 6 commits intonodejs:v6.xfrom
Conversation
snyamathi
commented
Aug 15, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
Fixes a bug where the wrong stream was being registered with the finalization registry when cloning Response objects. This was causing premature cancellation of the original response's stream when the cloned response was garbage collected.
- Changed the stream registration from
out1toout2in the clone body logic - Added a test to verify that garbage collection of a clone doesn't affect the original response
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/web/fetch/body.js | Fixed stream registry to register the correct stream (out2 instead of out1) for the cloned instance |
| test/fetch/response.js | Added test to verify that garbage collection of cloned response doesn't break the original response |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
7 tasks
tsctx
approved these changes
Aug 17, 2025
Contributor
|
Merging as the failed CI is unrelated. |
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 relates to...
Rationale
The request/stream registered with the finalization registry is mixed up between the clone and the original request.
Changes
This PR just changes which of the two tee'd streams is associated
edit: updated with changes from @tsctx how we're fixing the stream registration is moved to a better location #4419
Features
N/A
Bug Fixes
See
changesaboveBreaking Changes and Deprecations
N/A
Status