Skip to content

WebTransportImpl: fail a pending read on stopSending - #661

Closed
afrind wants to merge 2 commits into
meta:mainfrom
afrind:stop-sending-on-request-cancel
Closed

afrind wants to merge 2 commits into
meta:mainfrom
afrind:stop-sending-on-request-cancel

Conversation

@afrind

@afrind afrind commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

StreamReadHandle::stopSending unregistered the QUIC read callback but left a
pending readStreamData() open. The peer's RESET_STREAM needed that callback to
fail the read, so the read stayed pending until the session closed.
stopSending now fails the pending read with its error code, as
WtStreamManager's ReadHandle does.

FakeSharedWebTransport's stopSending fired the write cancel token before it
finished updating the handle. A peer that closes the session in response
destroyed the handle mid-call, so the token now fires last. The fake also adds
deliverPeerReset, which lets a test deliver a RESET_STREAM to the read half
without resetting the writer.

🤖 Generated with Claude Code

afrind and others added 2 commits November 2, 2026 11:52
StreamReadHandle::stopSending unregistered the QUIC read callback but left a
pending readStreamData() promise open. The peer's solicited RESET_STREAM then
had no callback to arrive on, so the read did not complete until session
teardown. Fail the pending read, as WtStreamManager's ReadHandle does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FakeStreamHandle::stopSending fired the write cancel token before it finished
updating the handle. The fake wires both sessions together on one thread, so
the peer reacts inside that call. A peer that closes the session then destroys
the handle, and the rest of stopSending touched freed memory. Fire the token
last, as resetStream already does.

Add deliverPeerReset, which fails a read half without resetting the writer.
resetStream also fires the writer's cancel token, so a session on the writing
side reacts to its own reset and the reader cannot see a RESET_STREAM alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@afrind
afrind requested a review from hanidamlaj November 2, 2026 20:03
@meta-cla meta-cla Bot added the CLA Signed label Nov 2, 2026
@meta-codesync

meta-codesync Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@afrind has imported this pull request. If you are a Meta employee, you can view this in D129465241.

afrind added a commit to afrind/moxygen that referenced this pull request Nov 5, 2026
Cancelling a draft-18 request stream reset our write half, but STOP_SENDING
waited until the read loop exited, which could take until session close. A peer
that treats STOP_SENDING as the cancel kept the subscription and refused the
next SUBSCRIBE as a duplicate. The read loop now sends STOP_SENDING as soon as
the request is cancelled, whether by us or by a peer STOP_SENDING. The loop
exits promptly once WebTransportImpl's stopSending fails the pending read
(meta/proxygen#661). On session close, FETCH now cancels its data stream before
its request stream, so the peer sees the data stream's own error code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@meta-codesync meta-codesync Bot closed this in 7da8b99 Nov 6, 2026
@meta-codesync meta-codesync Bot added the Merged label Nov 6, 2026
@meta-codesync

meta-codesync Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

@afrind merged this pull request in 7da8b99.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant