Repository navigation
fix(net): a lite-07 drop ends a stream whose reset a browser lost - #9740
Conversation
Quest-Claim: 7119d34515bf398e
A lite-07 publisher names every group whose stream it resets without a reliable reset in SUBSCRIBE_DROP, so the drop now stands in for the reset a browser can lose: it ends a stream still reading the group, one waiting on a duplicate copy, or a one-shot fetch's stream, and a stream whose header the drop overtook is stopped unread. The excused-stream bound in Tail.settle is gone, so no JS lite-07 subscription waits out a timer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The drop stands in for a reset a browser can lose: it ends a stream still reading the group, one waiting on a duplicate copy, or a one-shot fetch's stream, and a stream whose header the drop overtook is stopped unread. Tail loses its excused streams, so its settle times nothing without a grace. The lite-07 draft says a subscriber may stop reading on the drop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ords it Aborting the group only once the read noticed the drop left it still arriving when dropTrackGroups ran, which then skipped a stale verdict for it. The drop now aborts the stream's group at once, as the lost reset would have. The draft changelog notes the subscriber MAY. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A stale drop must leave its group arriving, as the track's contract and the Rust copy do: when every byte landed, QUIC may ignore the reset and the group still ends whole. So the drop no longer aborts or stops the stream: it only lets go of the stream's hold on the subscription's end, which the draft already allows (a dropped Group Stream settles the tail). A final drop still ends the read through the track's abort. The one-shot fetch and the draft are back as they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s a failed copy A stream that takes its group from a copy that failed while it waited is owed again, as before, so it lets go only when it reads its own group. The comments and test now state that the track's release cuts a group a stale drop left arriving, rather than claiming it survives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The drop already named the stream's group on the wire, so taking the group from another subscription's failed copy does not make the stream's end trustworthy: its reset, which a browser can lose, may be all that is left. The test uses another subscription's copy, as the draft allows one stream per group per subscription. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. WalkthroughThe subscriber now releases active counted reads when a drop matches their group keys. Merge Risk:
|
Claims quest/m2/lite07-subscribe/excused-stream-drop.md, and finishes it (the quest file is deleted).
Problem
Chromium can lose the reset of a Group Stream it has not handed to the page yet, leaving the stream open forever. The JS lite-07 subscriber "excused" such a stream when a
SUBSCRIBE_DROPnamed its group, andTail.settlethen gave up on it after a timer (limit ?? GRACE). That was the last timer a JS lite-07 subscription waited out. Since moq-dev/moq#9686, a lite-07 publisher names every group whose stream it resets without aRESET_STREAM_ATcovering theGROUPheader, so the drop always comes. The draft already settles a subscriber's tail once every Group Stream is "read/reset/dropped" (draft line 235), so a dropped group's stream need not be waited for at all.Approach
Tailloses its excused streams (Counted.excuse,#excused). With no grace,settlearms no timer. Before lite-07 the grace andlimitbehave as before (nothing excused streams there).SKIP) naming a group lets go of the hold that group's streams have on the subscription's end (Counted.done), at once and with no timer. A stream whose header the drop overtook holds no end either, even if it then takes the group from another subscription's copy that failed.OLD) drop leaves the group arriving, as the track's contract (js/net/src/track.ts#drop) and Rust'sa_group_wins_over_its_stale_dropsay, until the stream's own end or the track's release.SubscribeEntry.readingis keyed by the stream'sCounted, so two streams of one group cannot overwrite each other.Rust needs nothing similar: its tail never excused streams, its transports always deliver a reset, and no Rust subscriber runs in a browser.
Impact
TailandCountedare@internaland not exported from@moq/net).SUBSCRIBE_END, the subscriber FINs without waiting on any stream a drop named, instead of waiting up toGRACE. A group that a stale drop left arriving and that has not finished when the publisher's FIN releases the track is cut withCancel. Before, it got up toGRACEto finish. Pre-lite-07 is unchanged.Alternatives
GRACE) for stale-dropped groups before releasing the track. Rejected: it is a lite-07 stall timer, which the epic's goal (quest/m2/lite07-subscribe/README.md) rules out.Decisions
Taken while the maintainer was away, each with the recommended option:
Cancel, rather than given a timed drain (see Alternatives). It only happens at a subscription's end, for a group the subscription's own budget already expired.Caused by
Validation
GRACE. All pass here with no clock advance. "A final drop after the header" already ended on the base, through the track's abort.Cancelat the release, and a stream a drop overtook holds no end after a takeover.bun testinjs/net: all pass.just ci(diff-selected): pass on the head. An earlier run hit the pre-existingcopy_fill.test.ts:66flake (3 of 30 reruns on the branch base too, plus 2 failures there), which moq-dev/moq#9735 owns asquest/m0/test-flakes-4/copy-fill-accept-after-close.md.just test interop --allon the head: all checks passed.just test stream-credit --version moq-lite-07-wip(Chromium and Firefox reading through a Rust relay that resets streams to make room): fails the same way on the head and on the branch base7297210187with the same relay binary. Firefox leaves 157 subscriptions open (170 on base), whichquest/m0/interop-green/firefox-lite07-stream-credit.mdowns. Chromium's fetches of stopped groups fail withTooFarBehind: laggedon both. The nightly reports the Chromium cell passing, so this is likely local load. No regression from this change.Follow-ups
runGroupread open until the session closes. Stopping it on a final drop would be cheap, but the drop no longer cuts reads by design. Worth a look withquest/m0/interop-green/firefox-lite07-stream-credit.md.Models
Size: S
Implementer: Claude Code, claude-opus-5-5, unknown (arm A)
(Written by Claude Opus 5.5)
Review
Rewritten by
quest reviewafter each round.Head: 3d85aa3
Base: origin/main at 83e10f0
Risk: medium,
The change alters JS lite-07 subscriber behavior (drop handling, removal of the excused-stream grace timer, and `Counted.excuse()` removed from `tail.ts`) without changing the wire format or any frozen API, so a mistake reaches only shipped code paths through the next cut and a revert fully undoes it; what could break is a lite-07 subscription hanging or ending early for consumers if a lost reset leaves a stream open, and the only thing that would push this to high is if `Tail`/`Counted` is part of the published `@moq/net` API, which I did not verify.Classified: medium by Claude Code, claude-haiku-5-5, low effort, session
2739b593-8562-4a69-9e0b-25c58162d7d0Risk file: bb7b1c0de60b
Reviewer: Codex, gpt-6.2-sol, medium effort
Session:
01a21bee-259f-7aa0-a030-27e366ff6679, round 3Score: 10/10,
The fix prevents a dropped stream from stalling subscription shutdown after a duplicate wait, and the incremental review found no new issues.Rounds: 5; first round 2 (medium 2); findings 4 (medium 4): fixed 2, refuted 2, open 0
Findings: none
The last round's findings, at 7d9d81c:
js/net/src/lite/subscriber.ts:3642:Keep a dropped stream excused after a duplicate wait;js/net/src/lite/subscriber.ts:3640 releases the overtaken stream’s tail hold even after it takes over a failed copy, and js/net/src/lite/subscriber.test.ts:1901 models a copy outside that tail and checks that the subscriber sends its FIN while the overtaken stream is still open.Reviewer: Claude Code, claude-opus-5-5, medium effort, second
Session:
3e8a5129-3b4e-4f36-9be4-e88692e05c7cRounds: 3; first round 1 (medium 1); findings 2 (medium 2): fixed 2, refuted 0, open 0