Skip to content

A lingering track refuses a restarted publisher's groups as duplicates #7973

Closed

Description

@michaelstuurman

Problem

An idle track copy that resumes with no Largest gets a live floor above its cache (answered: "whatever is cached is not its feed"), but claim_sequence still holds the cached sequences. A publisher that starts again from group 0 gets Error::Duplicate for every group still cached, so live readers wait until it passes the old newest group.

Seen with moq-relay main (99200d9) and openmoq/moqxr v0.4.15 as publisher, drafts 18 and 22:

sequenceDiagram
    participant V1 as viewer 1
    participant V2 as viewer 2
    participant R as moq-relay
    participant P as moqxr
    V1->>R: subscribe catalog
    R->>P: SUBSCRIBE
    P-->>R: SUBSCRIBE_OK, group 0
    R-->>V1: group 0
    V1->>R: leave
    R->>P: cancel
    Note over R: copy lingers, group 0 cached
    V2->>R: subscribe catalog
    R->>P: SUBSCRIBE
    P-->>R: SUBSCRIBE_OK without Largest
    Note over R: live floor 1: cached group 0 hidden
    P-->>R: group 0 again
    Note over R: Err(Duplicate): dropped
    Note over V2: waits forever
Loading

moqxr should report Largest there, and I'll raise that with them. A publisher that really restarted hits the same refusal.

Repro

On main, next to a_relative_start_on_an_idle_copy_skips_a_cache_the_route_disowns; fails at the first framed(&producer, 0, 1) with Err(Duplicate):

#[test]
fn a_restarted_feed_replaces_the_cache_the_route_disowns() {
	let mut producer = idle_copy();
	let mut reader = producer.subscribe(replay().with_ranges([Range::live()]));
	producer.set_live(None, None);
	assert_eq!(ready_groups(&mut reader), Vec::<u64>::new());

	framed(&producer, 0, 1).finish().unwrap();
	assert_eq!(ready_groups(&mut reader), vec![0]);
	framed(&producer, 1, 1).finish().unwrap();
	framed(&producer, 2, 1).finish().unwrap();
	assert_eq!(ready_groups(&mut reader), vec![1, 2]);
}

Tried

  • Accept a sequence below the floor and lower the floor to it: fixes the one-group catalog, but group 1 is then refused against the old cached group 1.
  • Displace the cache in answered's (None, Some(cached)) arm: group 0 is accepted but never read, probably because newest_produced still points at the old group 3. a_relative_start_on_an_idle_copy_skips_a_cache_the_route_disowns also fails.

Dropping the cache as if the track were new seems right, but it touches more state than I'd like to guess at. Which shape do you prefer? I can make it a PR.

(Written with Claude Opus 5.5)

Activity

  1. coderabbitai commented on Nov 5, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #7670 - feat(net)!: lite-07 SUBSCRIBE_SKIP and budget-qualified stale drops [open]
    #6428 - feat(stats)!: publish groups as tracks of one node broadcast [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. added
    questBeing tracked/planned in a quest. See `quest/`
    on Nov 6, 2026
  3. kixelated commented on Nov 6, 2026

    @kixelated
    Collaborator

    Thanks for the clear report and repro. I reproduced it on main; release predates the code, so it's main-only.

    Decision: rather than trusting the cache or dropping it, the relay will fail loud. When an idle copy resumes and its route answers behind what the copy already cached from that path (no Largest while it holds groups, or a Largest before its newest cached position), the copy fails its track with the stream-scoped MALFORMED_TRACK. Its readers get the error, and the next subscribe builds a fresh copy that accepts the feed from group 0. A cache that disagrees with its route is likely the wrong track, so the relay won't guess. A genuine restart that reuses group numbers on the same path remains unsupported and needs a new broadcast name (moq-dev/moq#4741). moqxr still needs to send Largest when it has content, as you planned to raise with them.

    This is tracked by the quest quest/m1/answer-behind-cache.md, planned in moq-dev/moq#8032. Since you offered to make the PR: anyone who wants to donate tokens can run /quest-start quest/m1/answer-behind-cache to pick it up. The quest's PR will close this issue.

    (Written by Claude Opus 5.5)

  4. kixelated commented on Nov 6, 2026

    @kixelated
    Collaborator

    Yeah I decided that this is a moqxr bug.

    If we ever get a SUBSCRIBE_OK that disagrees with our current cache... something is wrong. Either:

    1. The track is not the same, and our cache would be illegal to serve.
    2. The publisher is bugged and didn't send largest object.

    I think the right answer is to fail loud because there's an insidious 3rd case, where the track is not the same but the largest ID is higher. moq-transport is plagued by this issue because people keep reusing namespaces and track names, so I'd rather error loudly on 1 just to raise visibility.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questBeing tracked/planned in a quest. See `quest/`

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions