Repository navigation
fix(net): an update racing a moq-transport track's end closes no session - #9374
Conversation
Quest-Claim: 15b93cc3a54de4aa
…ssion While the END_OF_TRACK marker waited for stream credit, the publisher read the request stream expecting only its end, so a REQUEST_UPDATE that crossed the run's end closed the session with PROTOCOL_VIOLATION, costing every other broadcast. It now drops that update unanswered, as it does one crossing PUBLISH_DONE, and poll_update closes the session on a malformed update for every caller. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
ℹ️ No critical issues — one test-coverage suggestion inline.
Approach: sound — this fixes the actual source of the close (the END_OF_TRACK wait read the request stream with Messages::poll_end), and handles the crossing update the same way the path after PUBLISH_DONE already does. It is not just another workaround on the sender side.
Reviewed changes
I reviewed the full diff at 5b54c3f: the publisher's END_OF_TRACK wait, the UpdateRead consolidation, and the new regression test.
Publisher::poll_ended_cancel— while the marker waits for credit, an update is admitted and dropped instead of closing the session. A cancel, failure, writer close, or session close still abandons the marker.UpdateRead::Malformedfolded intoFailed—poll_updatenow closes the session itself throughgoaways.failed(err), so the duplicate close blocks inRunSubscriptionandWaitResumeare gone. The behavior stays the same: GOAWAY errors were already closed throughMessages::receive, and other errors still close only on a protocol violation.- Regression test —
an_update_crossing_the_end_of_track_keeps_the_sessioncovers all drafts. It parks the marker without credit, sends an update, and checks that no close happens, that PUBLISH_DONE goes out, and that no REQUEST_OK is sent.
I also checked the other request_stream::poll_cancel callers: the joining FETCH, FetchState::Prepare/Respond, and TRACK_STATUS. None of them serve a subscription that can receive a REQUEST_UPDATE, so the same race does not reach them.
claude-opus-5-5 | 𝕏
|
quest land watch: ended this pull request's pick, disarming its auto-merge, since its head 5b54c3f is held by finding by pullfrog[bot]: (written by quest land watch) |
|
No actionable comments were generated in the recent review. WalkthroughThe publisher now routes update decode and GOAWAY-processing errors through the failed path. Decode errors pass through Severity of issue fixed: Low Merge Risk:
|
Production's END_OF_TRACK wait now runs through Publisher::poll_ended_cancel, so the test checking that a second GOAWAY still closes the session there drives it instead of request_stream::poll_cancel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found. The previous test-coverage finding is addressed.
Reviewed changes
I reviewed the one commit added since the last review, 00a0047. It changes only a test.
- Retargeted the final-marker GOAWAY test.
a_subscription_keeps_its_goaway_count_until_the_final_markernow callsPublisher::poll_ended_cancel, the same wait that production'sEndOfTrackstep uses, and still checks for the0x03session close. Ifgoawayswere reset before the marker, the pushed GOAWAY would count as the first one. The poll would then stay pending andcloses()[0]would be missing, so the test now catches the regression it is named for.
claude-opus-5-5 | 𝕏

Closes the quest
quest/m1/ietf-update-race-session-close.md(deleted here).Problem
On a moq-transport session, a REQUEST_UPDATE (SUBSCRIBE_UPDATE) that crossed the end of its track closed the whole session with PROTOCOL_VIOLATION, which cost every other broadcast on it. moq-dev/moq#9265 worked around this by no longer sending the from-zero update that hit the race, so the close itself was still there.
The close came from the publisher. After a track ends,
Servingsends a standalone END_OF_TRACK marker. While that marker waits for stream credit, it watched the request stream withrequest_stream::poll_cancel, and that treats any message asUnexpectedMessage. So an update that crossed the run's end causedMessages::failed, and that closed the session.Approach
ServingStep::EndOfTracknow waits inPublisher::poll_ended_cancel. It reads the stream withpoll_update, so a crossing update gets its Request ID admitted and is then dropped without an answer. The PUBLISH_DONE that follows answers it, the same waypoll_retain_joinalready handles an update that crosses PUBLISH_DONE. The subscriber cancelling, STOP_SENDING, or the session closing still abandon the marker, as before. Its loop yields on a coop budget, aspoll_discarddoes.poll_updatenow closes the session itself on a protocol-violating read. Its two existing callers (RunSubscription,WaitResume) did that close the same way and otherwise treatedMalformedlikeFailed. SoUpdateRead::Malformedis merged intoFailed, and the duplicated close blocks are removed.Impact
Unattended choices, for review
The maintainer was away. I took my recommendation on each of these, and a review can undo any of them:
UpdateRead::MalformedintoFailed, with the close moved intopoll_update. Rejected: keeping both variants and adding a third copy of the close.Validation
wire_bounds(coveredforced to false), which restores the from-zero update. Stressing the moq-ffiserver_client_run_end_draft22test binary failed in 1 of 100, 1 of 150, 5 of 200, and 2 of 200 runs. Every failure was either "the next run was never handed out" or aSession(ProtocolViolation)on the client.request_stream::Messages::failed←poll_end←poll_cancel←publisher::Serving::poll(theEndOfTrackstep), with the reason "unexpected message".server_client_run_end_draft{18,20,22}passed 600 of 600 runs (200 each). The new "update crossed the end of track" path fired in 6 of 100 logged draft-22 runs, and all of them passed.ietf::publisher::serve_tests::an_update_crossing_the_end_of_track_keeps_the_sessioncovers drafts 18, 20, and 22. It parks the END_OF_TRACK marker without stream credit, pushes a SUBSCRIBE_UPDATE, then checks that no session close happens, that PUBLISH_DONE goes out, and that no REQUEST_OK is sent. It fails without the fix, because the request ends on the update.just checkpassed (Rust nextest 11128 tests),just cipassed, andjust test interop --allpassed. After Pullfrog's finding retargeted the final-marker GOAWAY test atpoll_ended_cancel(00a0047),just checkpassed again.Caused by
Messages::poll_end, which closes the session on any message, so an update crossing the track's end closed the session (found by check: moq-ffiserver_client_run_endon moq-dev/moq#9265)Follow-ups
None.
Models
Size: M
Implementer: Claude Code, claude-opus-5-5, unknown effort (arm B)
Implementer: Claude Code, claude-opus-5-5, unknown effort (iterate, M, arm B)
🤖 Generated with Claude Code
Review
Rewritten by
quest reviewafter each round.Head: 5b54c3f
Base: origin/main at 1dd0968
Risk: medium,
What could break: moq-net's IETF publisher stops closing the whole session on a malformed REQUEST_UPDATE and on an update crossing a track's end, so peers relying on those protocol-violation closes now get only the one subscription ended, a behavior change in shipped code that keeps the API and wire format; a revert restores the old behavior fully, and the deleted quest plan is documentation only, so this is a medium bug fix, not a high wire or API change.Classified: medium by Claude Code, claude-haiku-5-5, low effort, session
a1f62202-7d06-45d6-b503-1aba6a780a96Reviewer: Codex, gpt-6.1-sol, high effort
Session:
01a20283-6811-7bd0-b1ee-a1e1095a1186, round 1Score: 9/10,
The fix tolerates updates crossing track completion while preserving cancellation and malformed-message handling; no actionable defects were found, though builds and tests were not run as instructed.Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none
Note on the risk line: a malformed REQUEST_UPDATE still closes the session, now from
poll_updatefor every caller. Only a well-formed update that crosses the track's end stops closing it.Since the reviewed head, 00a0047 only retargets one test, fixing Pullfrog's single low-severity test-coverage finding, which /quest-merge exempts from a new review round.