diff --git a/js/net/src/lite/datagram-tracks.test.ts b/js/net/src/lite/datagram-tracks.test.ts index e8c81d01445..9d86ca3bfe5 100644 --- a/js/net/src/lite/datagram-tracks.test.ts +++ b/js/net/src/lite/datagram-tracks.test.ts @@ -1,4 +1,4 @@ -import { expect, spyOn, test } from "bun:test"; +import { expect, onTestFinished, spyOn, test } from "bun:test"; import { yieldNow } from "@moq/clock"; import { Signal } from "@moq/signals"; import { accept, connect } from "../connection/index.ts"; @@ -486,22 +486,22 @@ for (const alpn of [ALPN_05, ALPN_06, ALPN_07_WIP]) { // microtasks. A write-budget yield is a host task that the drain below can't advance, // so under CPU load the publisher's answer could still be stalled when the abort lands. const budget = spyOn(Budget.prototype, "poll").mockImplementation(() => undefined); - try { - await reader.info(); - while (datagrams.priority.peek() !== 5) await datagrams.priority.changed(); - datagrams.finish(); - // The mock delivers the end in microtasks, all within this host task. - for (let i = 0; i < 10000; i++) await Promise.resolve(); - client.abort(); - expect(await reader.recv()).toBeUndefined(); - } finally { + // Runs even when the test times out with a wait still pending. + onTestFinished(() => { budget.mockRestore(); reader.close(); remote.close(); client.abort(); server.abort(); source.close(); - } + }); + await reader.info(); + while (datagrams.priority.peek() !== 5) await datagrams.priority.changed(); + datagrams.finish(); + // The mock delivers the end in microtasks, all within this host task. + for (let i = 0; i < 10000; i++) await Promise.resolve(); + client.abort(); + expect(await reader.recv()).toBeUndefined(); }); } diff --git a/quest/m2/cluster-routing/routes/js.md b/quest/m2/cluster-routing/routes/js.md index d0748c700c4..cd01f10c22e 100644 --- a/quest/m2/cluster-routing/routes/js.md +++ b/quest/m2/cluster-routing/routes/js.md @@ -37,7 +37,7 @@ the cheapest one; fix it with the route-selection rework here. route-wire quarantine (every replacement publisher pins lite-07 even for older readers). Keep the separate Firefox audio-tone quarantine until [moq-dev/moq#8058](https://github.com/moq-dev/moq/pull/8058) resolves it. - The local drain/datagram recipes and explicit `--cases replacement` remain + The local drain/datagram recipes and `just test media --media-cases replacement` remain available to validate the port. ## Required diff --git a/quest/m3/spawn-audit.md b/quest/m3/spawn-audit.md index 9e653f6eec2..90570841267 100644 --- a/quest/m3/spawn-audit.md +++ b/quest/m3/spawn-audit.md @@ -66,8 +66,9 @@ Changed 2026-11-07 (maintainer, /quest-plan from the API sweep of open PRs and r Settled 2026-11-08: the public entry points that leave a task running past their call are kept, each on a dependency that already needs a tokio runtime, with the reason at the site: moq-hls `Server::broadcaster` (axum), moq-auth `Client::connect` and -`attach` (reqwest), and moq-webrtc as a whole (moq-tokio, axum, tokio sockets; see its -crate docs). Every other non-test spawn in a library sits inside a future its -caller awaits (moq-transcode's rungs) or behind private API (moq-transcode's -`Feed` and moq-video's PipeWire `SessionGuard`), so converting it changes no -public signature. +`attach` (reqwest), moq-webrtc as a whole (moq-tokio, axum, tokio sockets; see its +crate docs), and moq-video `capture::open` on Linux PipeWire (ashpd), whose portal +session task closes the session after the returned stream drops. Every other non-test +spawn in a library sits inside a future its caller awaits (moq-transcode's rungs) or +behind private API (moq-transcode's `Feed`), so converting it changes no public +signature. diff --git a/rs/moq-auth/src/client.rs b/rs/moq-auth/src/client.rs index 29bae193f69..8c4389db9e6 100644 --- a/rs/moq-auth/src/client.rs +++ b/rs/moq-auth/src/client.rs @@ -88,6 +88,9 @@ impl Client { /// deadline is the bound, and dropping the future drops the request. Every later /// request for the session ([`attach`](Self::attach), revalidate, end) is bounded /// on its own, since nothing else bounds it. + /// + /// The end POST runs on the tokio runtime after the lease drops; await + /// [`reported`](lease::Consumer::reported) before shutting the runtime down. pub async fn connect(&self, request: Request) -> crate::Result { if request.auth.is_some() { return Err(Error::Refused(Default::default())); @@ -97,6 +100,8 @@ impl Client { } /// Verify another credential for this connection and report its own end when it closes. + /// + /// Like [`connect`](Self::connect), the end POST needs the runtime alive after the lease drops. pub async fn attach(&self, connection: &lease::Consumer, request: Request) -> crate::Result { let context = connection.context().ok_or(Error::Refused(Default::default()))?; let context = context.attach(&request, &self.identity)?; diff --git a/rs/moq-hls/src/server/mod.rs b/rs/moq-hls/src/server/mod.rs index ef8b838adc6..2f1739f5e30 100644 --- a/rs/moq-hls/src/server/mod.rs +++ b/rs/moq-hls/src/server/mod.rs @@ -211,7 +211,8 @@ impl Server { /// publisher keeps sending. Ask again for the replacement, which starts at once. /// /// Spawns the path's follower and each instance's driver on the tokio runtime, since the - /// server is an axum edge; they end once the path is forgotten or the server drops. + /// server is an axum edge. The follower ends once the path is forgotten or the server + /// drops; a driver lasts while its [`Broadcaster`] or renditions are held. pub async fn broadcaster(&self, name: &str) -> Option { Some(self.followed(name).await?.current()) } diff --git a/rs/moq-webrtc/src/lib.rs b/rs/moq-webrtc/src/lib.rs index 5c51a7630f4..3fa80235a54 100644 --- a/rs/moq-webrtc/src/lib.rs +++ b/rs/moq-webrtc/src/lib.rs @@ -31,8 +31,9 @@ //! //! ## Runtime //! -//! The crate is a tokio edge, built on `moq-tokio`, axum, and tokio sockets: its entry -//! points spawn their session drivers on the current tokio runtime. +//! The crate is a tokio edge, built on `moq-tokio`, axum, and tokio sockets. The bundled +//! routers spawn session drivers on the current tokio runtime; `accept` callers run +//! [`Response::run`] themselves. //! //! ## Bitstream gotcha //! diff --git a/test/interop/clients/js/media.ts b/test/interop/clients/js/media.ts index 926b5fd2115..8e68b07b07e 100644 --- a/test/interop/clients/js/media.ts +++ b/test/interop/clients/js/media.ts @@ -168,7 +168,8 @@ if (!native && values.cases === undefined && playerEngine === "firefox") { } // Every replacement publisher pins lite-07, including the lite-06 and IETF reader legs. // An explicit --cases replacement remains available while porting the route wire. -if (values.cases === undefined && selected.delete("replacement")) { +if (!native && values.cases === undefined) { + selected.delete("replacement"); console.error("QUARANTINE\treplacement\tJS lite-07 route wire awaits quest/m2/cluster-routing/routes/js.md"); }