Skip to content

Revert "Capture strong ref to internal stream in internal.c++"#6153

Merged
jasnell merged 1 commit intomainfrom
jasnell/temp-revert-a6fa6a57
Feb 24, 2026
Merged

Revert "Capture strong ref to internal stream in internal.c++"#6153
jasnell merged 1 commit intomainfrom
jasnell/temp-revert-a6fa6a57

Conversation

@jasnell
Copy link
Copy Markdown
Collaborator

@jasnell jasnell commented Feb 24, 2026

This reverts commit a6fa6a5.

Causes a conflict with an internal floated patch. Will need to resolve the conflict before reloading.

@jasnell jasnell requested review from a team as code owners February 24, 2026 16:29
@jasnell jasnell enabled auto-merge February 24, 2026 16:30
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Feb 24, 2026

This is a clean revert. The original commit (a6fa6a5) added ref = addRef() captures in two lambda closures to prevent the owning ReadableStream (and thus the controller) from being garbage collected while a read promise was pending. The revert removes those captures.

The PR description explains the rationale: it conflicts with an internal floated patch and will be re-landed after resolving that conflict.

The key question is whether this revert reintroduces a use-after-free risk. The original commit message says "In some edge cases, the this can be collected while the promise is still pending." The controller captures this in the lambdas, and owner is a bare kj::Maybe<ReadableStream&> (non-owning reference). Without the addRef() capture, if the ReadableStream JS object gets GC'd while the kj::Promise is in flight, the controller could be destroyed and the lambda would dereference a dangling this.

However, this is the author reverting their own commit with a clear explanation that it's temporary (conflicts with an internal patch, will be re-resolved). The code existed without the addRef() captures before the original commit landed (just yesterday), so this is restoring the prior state temporarily.

LGTM

github run

@jasnell jasnell merged commit 355562f into main Feb 24, 2026
49 of 53 checks passed
@jasnell jasnell deleted the jasnell/temp-revert-a6fa6a57 branch February 24, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants