From 606404e2e38d38b9450ff19c02a79ffe9134279c Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 22 Oct 2026 18:48:29 -0700 Subject: [PATCH 1/3] chore(quest): claim quest/m1/test-flakes-2/resource-instrumentation.md Quest-Claim: aba1f1b3ce5aa8bf From 058a24ce763fb3735650c77555d73d1d72acdca8 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Thu, 22 Oct 2026 19:08:07 -0700 Subject: [PATCH 2/3] test(media): diagnose resource ownership before detach Co-Authored-By: GPT-6 --- quest/m1/test-flakes-2/README.md | 1 + quest/m1/test-flakes-2/media-tone-windows.md | 42 +++++++++++++++++++ .../test-flakes-2/resource-instrumentation.md | 23 ++++++++++ test/interop/clients/js/media.ts | 17 +++++--- 4 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 quest/m1/test-flakes-2/media-tone-windows.md diff --git a/quest/m1/test-flakes-2/README.md b/quest/m1/test-flakes-2/README.md index ca2565fd675..70ee7be9777 100644 --- a/quest/m1/test-flakes-2/README.md +++ b/quest/m1/test-flakes-2/README.md @@ -42,6 +42,7 @@ Public API: none. Wire: none. - [Union renewal](/quest/m1/test-flakes-2/auth-union-renewal.md) - the JS subscriber never leaves a torn REQUEST_UPDATE on the stream - [One process](/quest/m1/test-flakes-2/one-process.md) - no test writes process-wide env or unwraps the crypto provider install - [Media resource instrumentation](/quest/m1/test-flakes-2/resource-instrumentation.md) - the media test stops seeing a playing player report nothing to release +- [Media tone windows](/quest/m1/test-flakes-2/media-tone-windows.md) - the existing audio-tone agreement survives build load, fixed at its cause - [Interop cpp to js budget](/quest/m1/test-flakes-2/interop-cpp-js.md) - the cpp -> js cell finishes inside its 30 s budget, fixed at its cause ## Related diff --git a/quest/m1/test-flakes-2/media-tone-windows.md b/quest/m1/test-flakes-2/media-tone-windows.md new file mode 100644 index 00000000000..d1f46d1f43a --- /dev/null +++ b/quest/m1/test-flakes-2/media-tone-windows.md @@ -0,0 +1,42 @@ +# [S] Media playback keeps its tone through the existing grading windows + +## Goal + +The browser media interop test passes its existing audio-tone agreement checks +under build load, fixed at the cause of the missing tone samples. Keep its +window lengths, agreement threshold, and negative controls unchanged. + +## Plan + +Recurred on 2026-10-22 while investigating resource instrumentation at +[fd59eb18a5](https://github.com/moq-dev/moq/commit/fd59eb18a5), using Chromium +156.0.8078.4 through `nix develop --command just test media`: + +- An unconstrained full run failed the positive lifecycle's coded-size-growth + window with 69 matching audio-tone samples out of 80. All five negative + controls passed, including the leaked-session and lagging-latecomer controls. +- A full run restricted to two available CPUs passed the positive lifecycle + and the leaked-session control, then the lagging-latecomer control failed + earlier than intended: its cold-start audio had 70 matching samples out of + 82. The host diagnostic recorded 0.1% to 1.4% idle CPU in the failed window; + the player recorded 19 long animation frames, the longest 576 ms, while + the fixture recorded none. These observations do not identify a cause. + +[moq-dev/moq#6302](https://github.com/moq-dev/moq/pull/6302) recorded the earlier +cold-start recurrence and added the media-window diagnostics. Use those +diagnostics to distinguish capture, delivery, decoding, playout, and sampling; +reproduce a causal transition and test it with controlled time where possible. +Do not infer a production ring or estimator bug from low tone agreement alone. + +Existing work has different proof targets: the +[manual playout target proof](/quest/m1/audio-jitter-target/watch.md) requires +real microphone measurements on Chrome and Safari, while +[moq-dev/moq#6425](https://github.com/moq-dev/moq/pull/6425) fixes buffered audio +refill. Neither has been shown to own this media-window recurrence. Check them +before changing shared playback code, and reuse a demonstrated fix. + +Public API: none expected. Wire: none expected. + +## Related + +- [Media resource instrumentation](/quest/m1/test-flakes-2/resource-instrumentation.md) - five resource checks passed during these runs; the tone failures are separate diff --git a/quest/m1/test-flakes-2/resource-instrumentation.md b/quest/m1/test-flakes-2/resource-instrumentation.md index f374199391b..1e491a723b6 100644 --- a/quest/m1/test-flakes-2/resource-instrumentation.md +++ b/quest/m1/test-flakes-2/resource-instrumentation.md @@ -16,4 +16,27 @@ long animation frames and the host's busiest processes), then decide whether the player drops its resource handles early or the check samples before they exist. Never widen the check's wait to hide it. +Investigated on 2026-10-22 at +[fd59eb18a5](https://github.com/moq-dev/moq/commit/fd59eb18a5): one normal +detach-only run and one run of pause, disable, rejoin, and detach restricted to +two available CPUs passed. A full run on those two CPUs passed the positive +lifecycle and the leaked-session negative control; an unconstrained full run +also passed that control. These five checks saw ownership before detach and +released it correctly. The three checks with the added diagnostic each reported +one transport and one AudioContext before detach, with no socket or worker. +This did not reproduce the original failure or distinguish early release from +sampling before ownership exists. + +The draft checkpoint logs the successful ownership sample and, on an +instrumentation failure, the complete sampled player state plus the existing +bounded long-animation-frame diagnostics for both pages. It does not change +the predicate, waits, or production instrumentation. Capture a failing run with +this evidence, then fix the causal ownership or sampling transition and cover +that transition deterministically. The goal remains open. + +Both full runs failed separately on audio-tone agreement before reaching the +intended check in one of their cases. That recurrence belongs to +[Media tone windows](/quest/m1/test-flakes-2/media-tone-windows.md), not evidence +that resource instrumentation failed. + Public API: none expected. Wire: none. diff --git a/test/interop/clients/js/media.ts b/test/interop/clients/js/media.ts index 0a73fc5b0b9..f8b211be495 100644 --- a/test/interop/clients/js/media.ts +++ b/test/interop/clients/js/media.ts @@ -976,14 +976,21 @@ try { if (wants("detach")) { console.error("=== detach and reattach ==="); const busy = await readPlayerState(player); + console.error(` resources before detach: ${JSON.stringify(busy.resources)}`); // Its own assertion name, not "resource baseline": the leaked-session control expects that one // to fail, so sharing it would let broken instrumentation satisfy the control without the // leaking detach ever running. - check( - busy.resources.transports + busy.resources.sockets > 0 && busy.resources.audioContexts > 0, - "resource instrumentation", - () => `the player holds nothing to release while playing: ${JSON.stringify(busy.resources)}`, - ); + try { + check( + busy.resources.transports + busy.resources.sockets > 0 && busy.resources.audioContexts > 0, + "resource instrumentation", + () => `the player holds nothing to release before detach: ${JSON.stringify(busy)}`, + ); + } catch (err) { + const end = Date.now(); + await explainStalls(player, { start: end - WINDOW_MS, end }, "resource instrumentation", undefined); + throw err; + } if (values.leak) { await command(player, "startLeak"); From eee58dd41cceee12bb2108ddd0567821e533ce76 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 26 Oct 2026 10:21:53 -0700 Subject: [PATCH 3/3] quest: delete media resource instrumentation The original failure has not reproduced, and the only work left on it was a diagnostic checkpoint with no causal fix. Co-Authored-By: Claude Opus 5.5 --- quest/m1/test-flakes-2/README.md | 1 - .../test-flakes-2/resource-instrumentation.md | 19 ------------------- 2 files changed, 20 deletions(-) delete mode 100644 quest/m1/test-flakes-2/resource-instrumentation.md diff --git a/quest/m1/test-flakes-2/README.md b/quest/m1/test-flakes-2/README.md index 54ca836172f..a289e166397 100644 --- a/quest/m1/test-flakes-2/README.md +++ b/quest/m1/test-flakes-2/README.md @@ -40,7 +40,6 @@ Public API: none. Wire: none. ## Required -- [Media resource instrumentation](/quest/m1/test-flakes-2/resource-instrumentation.md) - the media test stops seeing a playing player report nothing to release - [moq-cli relay tests under load](/quest/m1/test-flakes-2/cli-relay-load.md) - the fetch and announced tests wait on events, not timing - [FFI publisher audio gaps](/quest/m1/test-flakes-2/ffi-audio-gap.md) - interop tone checks stop finding gaps from FFI publishers - [moq-uring allocations under load](/quest/m1/test-flakes-2/uring-alloc-load.md) - the steady-state send test and MEMLOCK users pass in a parallel check diff --git a/quest/m1/test-flakes-2/resource-instrumentation.md b/quest/m1/test-flakes-2/resource-instrumentation.md deleted file mode 100644 index f374199391b..00000000000 --- a/quest/m1/test-flakes-2/resource-instrumentation.md +++ /dev/null @@ -1,19 +0,0 @@ -# [S] The media test's resource instrumentation reports what the player holds - -## Goal - -The media interop test's resource instrumentation check passes reliably under -a loaded `just check`, fixed at its cause. It sometimes fails with the player -reporting nothing to release while it is still playing. - -## Plan - -Seen twice locally while working -[moq-dev/moq#6302](https://github.com/moq-dev/moq/pull/6302), once with the -fixture's mono pin and once without, so the pin is unrelated. Reproduce under -load with the diagnostics #6302 added (a failed media window prints each page's -long animation frames and the host's busiest processes), then decide whether -the player drops its resource handles early or the check samples before they -exist. Never widen the check's wait to hide it. - -Public API: none expected. Wire: none.