Skip to content

watch (dev): auto mode sends a fractional maxAge, the varint encoder throws, and every media SUBSCRIBE fails on any real RTT #3478

Closed

Description

@fperex

Summary

On dev, <moq-watch> in auto mode (the "Auto" chip; latency="real-time" maps to it) computes its jitter term as 1.25 x minRTT without rounding and passes the resulting maxAge straight into the SUBSCRIBE varint. On any path whose product is not an integer (every real path; localhost's 1 ms RTT lands on the 20 ms integer floor) the varint encoder throws, both media subscriptions fail with no retry, and the element sits at status=live with 0 bytes for as long as it lives. Split out of #3477, where it blocked measuring auto mode on dev against the public relay.

Environment

  • upstream/dev 30ef2a3 (chore: merge main into dev, 2026-09-06), js/watch and js/net unmodified apart from timestamp probes.
  • Chrome 152.0.7977.82 and Safari 26.6 on macOS 26.6.1 (Mac mini, Apple M4).
  • Public relay https://cdn.moq.pro/demo, broadcast bbb.hang, RTT 46 ms in the run quoted below (39 ms in a second run, same outcome).
  • Not present on upstream/main (2345699), see below.

Observed

Console 0.9 s after connect:

subscribe error: id=2 broadcast=bbb.hang track=0.avc3 error=The number 60.5 cannot be converted to a BigInt because it is not an integer
subscribe error: id=3 broadcast=bbb.hang track=0.aac error=The number 57.5 cannot be converted to a BigInt because it is not an integer

followed by an unhandled spawn error. Nothing resubscribes. For the whole 60 s window the element reports status=live, audio stalled, video stalled, 0 bytes received. The catalog subscription (integer priority, no maxAge) keeps working, which is why the status says live.

Mechanism

  • js/watch/src/sync.ts #runJitter: jitter = max(20, minRtt * 1.25) with no rounding (46 ms -> 57.5, 39 -> 48.75).
  • js/watch/src/media.ts subscribeMedia passes sync.out.maxAge (codec floor + jitter, 60.5 for video and 57.5 for audio here) into Subscription.maxAge unchanged.
  • js/net/src/lite/subscribe.ts writes it with w.u53(this.maxAge), and js/net/src/varint.ts encodeTo converts through BigInt, which throws RangeError on a non-integer.
  • The throw happens inside the media subscription's spawn, so nothing catches it and nothing retries.

Why main does not show it

upstream/main rounds the wire value with Math.ceil in js/watch/src/audio/subscription.ts (added by #3114, with a unit test that feeds it 38.75 ms and 500.25 ms). dev never had that file: its media.ts (from #2926, reshaped by #3396) carries no rounding, and each merge of main into dev (bac2850, ac69338, b4cc67a, 30ef2a3) resolved the conflict by dropping main's subscription.ts, so neither the rounding nor its test reached dev.

Repro

<moq-watch url="https://cdn.moq.pro/demo" name="bbb.hang" latency="real-time"> (or delay="auto") on dev, against any relay with an RTT of 17 ms or more whose RTT x 1.25 is not an integer. With a diagnostic Math.ceil on the wire value in media.ts the same page subscribes and plays; that is how the auto rows on dev in #3477 were measured.

Tested: upstream/dev 30ef2a3; upstream/main 2345699 read for subscription.ts.

Activity

  1. fperex commented on Sep 6, 2026

    @fperex
    ContributorAuthor

    The run that hit this is on the debug/rt-audio branch of my fork (pinned https://github.com/fperex/moq/tree/12059c7fb4a232f5caa4975a8c9adb0338b5782f): the console lines and the 60 s of status=live with 0 bytes are in debug-findings/runs/e5-remote-bbb/ (driver log and summary; the full watch-auto trace is in the release tarball linked from debug-findings/README.md), and the labelled diagnostic Math.ceil used to measure auto mode on dev afterwards is in that branch's js/watch/src/media.ts. Shared for reproduction only; not a pull request.

  2. added
    questBeing tracked/planned in a quest. See `quest/`
    on Sep 7, 2026
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