Skip to content

moq-net: no way to accept a track::Request with content, so a lazily served relay track can answer SUBSCRIBE_OK without Largest Location #5862

Closed

Description

@allyblockcast

Problem

A relay that serves a track lazily (broadcast::Dynamic::requested_track → track::Request::accept) and already holds earlier objects for that track cannot get them into the track before the waiting subscriber snapshots its live edge.

In ietf/publisher.rs the SUBSCRIBE handler does track.subscribe(..).await and then immediately live_edge(&cache), which builds SUBSCRIBE_OK's Largest Location. subscribe() resolves as soon as track::Request::accept commits. The relay can only write its retained group through the track::Producer that accept returns, so that write always happens after the request is visible as accepted. On a multi-thread runtime the publisher task can run in between, and SUBSCRIBE_OK then omits Largest Location for a track that has been published.

Measured on moq-net 0.3.10, from a relay that replays its retained group on the same task right after accept, with no .await in between: 2 omissions in 320 runs. The wire was checked with a raw client.

This affects every IETF version whose SUBSCRIBE_OK carries the largest location, not one draft.

Ask

A public way to accept a track::Request with content already in it, so the first reader cannot observe the accepted-but-empty state. Two possible shapes:

  • a track::Request::accept_with(info, |producer| { /* write groups */ }) that commits after the closure returns, or
  • writing through the request before accept (the pending TrackState already exists).

The only workaround without this is to patch the crate.

Repro sketch

  1. origin.dynamic(""). On requested_track, call request.accept(info), then on the same task with no .await, create_group + write_frame + finish for an earlier group.
  2. A raw IETF client SUBSCRIBEs and reads SUBSCRIBE_OK. Over a few hundred runs, Largest Location is sometimes absent.

Activity

  1. kkroo commented on Oct 17, 2026

    @kkroo
    Contributor

    Blockcast relay validation is now tracking this as the smallest upstream capability needed for draft-20 relay fidelity.

    At pim#3825 head 54e221144a948a636ea07ca5c the relay-side replay fix is present and the focused wire vector observes SUBSCRIBE_OK LARGEST_OBJECT=(41,0), but the branch is still behind and has not been promoted as a three-receiver artifact. The remaining race is the one described here: a lazy accept() can expose an accepted-but-empty track before replay commits.

    A supported accept_with/pre-accept producer shape would let the relay preserve the invariant without a private moq-net fork. If an API is accepted, we will consume the upstream pin and rerun the exact wire/fidelity and three-receiver gates.

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

    @kixelated
    Collaborator

    Decision: folded into the public ingest design: one pre-accept shape accepts the track idle, lets the caller write retained groups, then goes live, so no reader sees it accepted but empty. A closure-style accept_with(info, |producer| …) is not the shape we'll take. The crate's own TRACK_STATUS accept/idle race gets fixed with it.

    Tracked by quest/m1/public-model/ingest.md.

    Planned in #5969. Anyone who wants to donate tokens can run /quest-start quest/m1/public-model/ingest to pick it up.

    (Written by Claude Opus 5.5)

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