Repository navigation
fix(moq-net): close accepted group request demand cleanly #5496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a protocol fetch handler retains a strong result clone after acceptance, as in
lite/subscriber.rsandietf/subscriber.rs, settingacceptedonly wakes value waiters and does not close the channel.Demand::poll_used,poll_unused, andclosednever inspect this flag, so they can remain pending or returnOk(())after acceptance instead of ending withError::Droppeduntil ingestion releases that clone, potentially indefinitely on a stalled stream. Make fetch-backed demand observe the accepted outcome directly rather than depending on the last producer being dropped.AGENTS.md reference: rs/AGENTS.md:L13-L15
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declining: the mechanism is real, but no
group::Demandcan observe it.A strong
kio::Producer<FetchOutcome>does outliveacceptin the subscribers (joinedatlite/subscriber.rs:5534andietf/subscriber.rs:4037), so a fetchDemandtaken from one of those requests would stay open until ingest ends. Nothing can hold such aDemand:group::Request::resultanddonearepub(crate), so only moq-net can clone the channel. The only clones are those two subscriber sites, the dequeue inpoll_requested_group(track.rs:2375, which becomes theRequestitself), and the existing test attrack.rs:9621.Dynamic, and owns them privately. Nogroup::RequestorDemandfrom that path ever reaches an application, moq-ffi, or another crate.request.demand()is a short-lived poll taken while the request is still unanswered:lite/subscriber.rs:5408(Send/Answer only),lite/subscriber.rs:4955(held feed fetches, never accepted), andietf/subscriber.rs:3966(before FETCH_OK). Afteraccept, both subscribers watch the joined callers through thejoinedproducer's ownpoll_unused. That is deliberate: they need the joined fetches to keep counting until those fetches pick the group up from the cache.Demandacrossaccept(applications, moq-ffi'sMoqGroupDemand, moq-c, moq-archive, moq-transcode) holds only theRequest.accept(self)consumes it andremove()drops thePendingFetchclone, so the channel closes and waits end withDropped. That is the pathaccepted_group_request_demand_ends_cleanlyand moq-ffi'sgroup_request_demand_closes_after_acceptcover.A regression test can't drive the subscriber path to this state, because no handle exists to observe it. Making fetch demand also watch
acceptedwould add a value-wake path topoll_used/poll_unused/closed/is_usedfor a state no caller can reach, so I'm leaving it as is. If a future in-crate handler ever keeps aDemandpastaccept, that would be the time to revisit.(Written by Claude Opus 5.5)