Repository navigation
fix(net): end moq-transport requests stalled on send credit - #7016
Conversation
Quest-Claim: cfb3a4e274143dda
Every request write in the IETF subscriber awaited its first message before watching for cancellation, so a peer withholding send credit pinned a cancelled SUBSCRIBE, FETCH, TRACK_STATUS, or SUBSCRIBE_NAMESPACE. Each request now buffers its message and flushes it inside the wait that already watches its terminals, as SUBSCRIBE_TRACKS did. Established REQUEST_UPDATEs and held pauses flush the same way. A request cancelled before its message fully left resets its stream: a FIN would hand the peer a truncated message. `Writer::close` resets in that case, and the cancel paths that wait for the peer's half skip the wait. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 15 minutes. View limit details
No actionable comments were generated in the recent review.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: daf16d96ec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: daf16d9
Confirmed the existing buffered-update termination finding, rather than duplicating its inline comment: in rs/moq-net/src/ietf/subscriber.rs, an Established REQUEST_UPDATE can remain buffered when End::Done reaches the unconditional writer.finish() cleanup. This violates the writer invariant and panics in debug builds. Use the flushed-versus-reset handling already present in the held watcher, and add a stalled-update + peer-end regression test.
Overall direction is sound: flushing inside the existing terminal-aware waits avoids duplicating cancellation checks, and resetting incomplete requests is preferable to FINing truncated messages. No additional actionable bugs found in the changed paths.
Verification: static inspection of the changes, surrounding cancellation/cleanup paths and new tests only. I did not run tests; the new stalled-initial-write tests do not exercise the Established-update termination above.
…update PUBLISH_DONE can end an Established subscription while a REQUEST_UPDATE the peer's send window held back is still buffered. The cleanup FINed the stream regardless, tripping Writer::finish's unflushed assertion and, in release builds, handing the peer a truncated update. Reset instead, as the held watcher does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 55e9adf17c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 55e9adf
Fixed: the previously referenced buffered-update termination panic. The Established cleanup now checks is_flushed() before FIN and otherwise resets, with a regression covering a partially sent update followed by PUBLISH_DONE.
Still actionable: I confirm the independent P2 held-handoff buffer growth finding. tracks.rs hands off a writer despite pending flush; repeated resume/cancel cycles append more forward/pause updates to that same stalled stream. Bound or coalesce those updates while retaining prompt cancellation, and test repeated churn under withheld credit. This was already present in the prior reviewed head, not introduced by this fix; my earlier review missed it. Referencing the existing thread rather than duplicating an inline comment.
Direction: the targeted cleanup fix is appropriately small and reuses the held-watcher invariant. No additional actionable bugs found in this delta. Verification was static inspection of the one-commit delta, regression test, and related handoff paths; I did not run tests.
Under withheld send credit, each resume a reader abandoned appended another REQUEST_UPDATE pair to the held stream's buffer, growing it with subscriber churn. The held watcher now hands the subscription over only once its writer has flushed, bounding the buffer to one resume and its pause, and the resumer stops waiting for that handoff once nobody wants the track. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: d0145f2
The previously referenced held-handoff buffer growth finding is addressed: the watcher now requires a flushed writer before handing it over, while the waiting resumer can abandon on lost demand. The new draft-18/22 churn regression checks prompt abandonment and only one resume/pause pair. The earlier termination-panic fix remains intact.
No new actionable bugs found in this delta. Backpressuring the handoff is a focused, simpler alternative to rewriting partially sent messages; cancellation and entry-removal handling remain available while flushing is stalled.
Verification: static inspection of the one-commit delta, surrounding handoff/demand cleanup and regression tests. I did not run tests.
|
Merging at d0145f2 (maintainer picked merge).
(Written by Claude Opus 5.5) |
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # rs/moq-net/src/ietf/subscriber.rs
|
Merged
No behavior change. (Written by Claude Opus 5.5) |
Problem
Every request write in
rs/moq-net/src/ietf/subscriber.rsawaited its firstencode_messagebefore it watched for cancellation. A peer that withholds send credit could therefore pin a cancelled SUBSCRIBE, FETCH (group or joining), TRACK_STATUS, or SUBSCRIBE_NAMESPACE, along with its state, until the session died. Established REQUEST_UPDATEs and held-subscription pauses had the same blind await.Approach
buffer_message) and flushes it inside the wait that already watches its terminals: validity, gate, demand,live, the joining cancel, or the entry going away. This is the patternsubscribe_tracksalready used. The paused SUBSCRIBE intracks.rsgets the same treatment.watchloop flush a buffered update or pause at the top of each wake, so they never block their other ends.write_updateandwrite_forwardbecome the syncbuffer_updateandbuffer_forward, andpauseis no longer async.Writer::closeresets with CANCELLED and returnsErr(Cancel)when bytes are still buffered. That coverscancel_subscribe, TRACK_STATUS, and joining FETCH.Writer::is_flushedlets the SUBSCRIBE_NAMESPACE and SUBSCRIBE_TRACKS cancel paths reset and skip waiting for the peer's half, since the peer holds nothing.JoiningTaskcomment saying a committed header "must still reach the peer" dated from drafts 14/15. Draft 18 limits INVALID_REQUEST_ID to a wrong low bit or a duplicate, andControl::accepttolerates gaps, so a reset is safe. The comment is updated.Tests use a new
ScriptedSession::with_send_window(bytes): each request stream takes 1 byte, then parks for good.invalid_setupmatrix gainsSubscribeWrite,StatusWrite, andFetchWritestages on drafts 18 and 22, each across all four invalidation causes. Every stage asserts the work finishes, sends a CANCELLED reset plus STOP_SENDING, and never sends a FIN. Onorigin/mainall three hang (Pending).Writer::close.a_stalled_update_resets_when_the_publisher_ends(draft 22) covers an update stalled behind PUBLISH_DONE. Without the guard it panics withfinish with unflushed bytes.churn_under_withheld_credit_buffers_one_resume_and_pause(drafts 18 and 22) churns three readers over a held track whose peer stopped reading. The peer drains exactly one resume and one pause; without the gate it drains six updates.just checkpasses.Impact
Alternatives
Writer::finishreset when unflushed. Rejected:finishkeeps the stream for laterpoll_closed, so a reset there would leave a dangling writer. Only the consumingcloseresets.Choices made without asking
Follow-ups
rs/moq-net/src/ietf/publisher.rs) has the same blind await:advertise_namespaceawaits its PUBLISH_NAMESPACE (and its updates) before watching withdrawal. That was left out to avoid colliding with moq-dev/moq#6999. It is also a candidate for the lease quest.(Written by Claude Opus 5.5)
🤖 Generated with Claude Code