From 017ee3d6b89c5485789a0e8dee1228251a17fba7 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Wed, 11 Nov 2026 14:00:07 -0800 Subject: [PATCH 1/2] chore(quest): claim quest/m0/lite07-compression-bench-hang.md Quest-Claim: be671ae2d2a5450d From f3de23117ae38e9954f8f4b339e0d2b8ac0e19cc Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Wed, 11 Nov 2026 16:20:27 -0800 Subject: [PATCH 2/2] fix(net): the auth bench presents in-band tokens only on lite-07 moq-transport dropped in-band AUTH in #8444, so a token added there resolves at once and no AUTH request reaches the peer. The admission and waiting groups still ran on moq-transport-22 and waited forever for that request, hanging Nightly's Rust bench targets before the session bench. The session_delivery_compression hang this quest tracked was the base build of the 11-10 Nightly, which predates #8352; it is already fixed. Co-Authored-By: Claude Opus 5.5 --- quest/m0/js-subscribe-drop-hang.md | 4 - quest/m0/lite07-compression-bench-hang.md | 26 --- rs/moq-net/benches/auth.rs | 208 +++++++++++----------- 3 files changed, 102 insertions(+), 136 deletions(-) delete mode 100644 quest/m0/lite07-compression-bench-hang.md diff --git a/quest/m0/js-subscribe-drop-hang.md b/quest/m0/js-subscribe-drop-hang.md index 25827263229..c7c5ef12103 100644 --- a/quest/m0/js-subscribe-drop-hang.md +++ b/quest/m0/js-subscribe-drop-hang.md @@ -19,7 +19,3 @@ minutes, and the benchmarks after it never ran. The stalled at the same header. Reproduce it locally; if the hang is in `@moq/net` rather than the benchmark, a test in the merge gate covers it. - -## Related - -- [session_delivery_compression finishes on lite-07](/quest/m0/lite07-compression-bench-hang.md) - another Nightly benchmark that hangs diff --git a/quest/m0/lite07-compression-bench-hang.md b/quest/m0/lite07-compression-bench-hang.md deleted file mode 100644 index 72d618f5f99..00000000000 --- a/quest/m0/lite07-compression-bench-hang.md +++ /dev/null @@ -1,26 +0,0 @@ -# [M] session_delivery_compression finishes on moq-lite-07 - -## Goal - -The `session_delivery_compression` Criterion group (moq-net's `session` -bench target, `rs/moq-net/benches/session/mod.rs`) finishes every -`moq-lite-07-wip` cell, and the root cause of the hang it shows is fixed. If -the hang is in moq-net rather than the benchmark harness, a test reproduces it -in the merge gate. - -## Plan - -`Nightly (Rust bench targets)` was cancelled at its 60-minute timeout on the -2026-11-02, 11-05, 11-06, 11-09, and 11-10 scheduled runs, and failed without -timing out on 11-03, 11-04, 11-07, and 11-08. -In [the 11-10 run](https://github.com/moq-dev/moq/actions/runs/42842827718/job/129922278472) -every `moq-lite-06` cell finished, then -`session_delivery_compression/moq-lite-07-wip/relays=1/publishers=1/broadcasts=1/viewers=1` -printed `Benchmarking` and nothing for the job's last 34 minutes, so the hang -starts with the first lite-07 cell, and every later bench in the job goes -unmeasured. Reproduce it locally, bisect against the lite-07 changes -if it is a regression, and fix it at the root. - -## Related - -- [JS subscribe-drop finishes](/quest/m0/js-subscribe-drop-hang.md) - another Nightly benchmark that hangs diff --git a/rs/moq-net/benches/auth.rs b/rs/moq-net/benches/auth.rs index 3b19ff6e40e..af16ee00a8d 100644 --- a/rs/moq-net/benches/auth.rs +++ b/rs/moq-net/benches/auth.rs @@ -20,6 +20,10 @@ use moq_net::{Session, Version, auth, origin}; use std::time::Duration; use support::{harness, mock::create_mock_session_pair}; +/// The one version that presents tokens in band: on moq-transport a token resolves at once +/// and only rides the requests that name it, so no AUTH request ever reaches the peer. +const INBAND: &str = "moq-lite-07-wip"; + struct Pair { client: Session, _server: Session, @@ -32,7 +36,8 @@ struct Origins<'a> { subscribe: origin::Producer, } -async fn pair(version: Version, origins: Option>) -> Pair { +async fn pair(origins: Option>) -> Pair { + let version: Version = INBAND.parse().unwrap(); let mut mock = moq_net::transport::memory::Config::default(); mock.protocol = Some(version.alpn().to_string()); let (client, server) = create_mock_session_pair(mock); @@ -92,27 +97,24 @@ fn admission(c: &mut Criterion) { .enable_all() .build() .unwrap(); - for version in ["moq-lite-07-wip", "moq-transport-22"] { - let mut group = c.benchmark_group(format!("auth/{version}")); - group.sample_size(10); - group.warm_up_time(Duration::from_millis(100)); - group.measurement_time(Duration::from_millis(300)); - for sessions in [1, 16, 64] { - for tokens in [1, 16, 128] { - group.throughput(Throughput::Elements((sessions * tokens) as u64)); - group.bench_with_input( - BenchmarkId::new(sessions.to_string(), tokens), - &(sessions, tokens), - |b, &(sessions, tokens)| { - let mut pairs = - runtime.block_on(join_all((0..sessions).map(|_| pair(version.parse().unwrap(), None)))); - b.iter(|| runtime.block_on(join_all(pairs.iter_mut().map(|pair| pair.round(tokens))))); - }, - ); - } + let mut group = c.benchmark_group(format!("auth/{INBAND}")); + group.sample_size(10); + group.warm_up_time(Duration::from_millis(100)); + group.measurement_time(Duration::from_millis(300)); + for sessions in [1, 16, 64] { + for tokens in [1, 16, 128] { + group.throughput(Throughput::Elements((sessions * tokens) as u64)); + group.bench_with_input( + BenchmarkId::new(sessions.to_string(), tokens), + &(sessions, tokens), + |b, &(sessions, tokens)| { + let mut pairs = runtime.block_on(join_all((0..sessions).map(|_| pair(None)))); + b.iter(|| runtime.block_on(join_all(pairs.iter_mut().map(|pair| pair.round(tokens))))); + }, + ); } - group.finish(); } + group.finish(); } /// A client publishing `origin` to its own server, whose session and token requests follow. @@ -235,96 +237,90 @@ fn waiting(c: &mut Criterion) { .enable_all() .build() .unwrap(); - for version in ["moq-lite-07-wip", "moq-transport-22"] { - let mut group = c.benchmark_group(format!("auth/waiting/{version}")); - group.sample_size(10); - group.warm_up_time(Duration::from_millis(100)); - group.measurement_time(Duration::from_millis(300)); - for tokens in [1, 16, 128] { - for paths in [1, 16, 128] { - group.throughput(Throughput::Elements(paths as u64)); - group.bench_with_input( - BenchmarkId::new(tokens.to_string(), paths), - &(tokens, paths), - |b, &(tokens, paths)| { - let _guard = runtime.enter(); - let mut config = origin::Config::new(std::num::NonZeroU64::new(2).unwrap()); - config.update_hold = Duration::ZERO; - let (publish, driver) = origin::Producer::new(config); - harness::spawn(driver); - let (receive, driver) = - origin::Producer::new(origin::Config::new(std::num::NonZeroU64::new(1).unwrap())); - harness::spawn(driver); - let mut pair = runtime.block_on(pair( - version.parse().unwrap(), - Some(Origins { - publish: &publish, - subscribe: receive.clone(), - }), - )); - let mut generation = 0; - b.iter(|| { - runtime.block_on(async { - let handle = pair.client.auth(); - let mut presenting = - std::pin::pin!(join_all((0..tokens).map(|_| handle.add("pending")))); - assert!(futures::poll!(presenting.as_mut()).is_pending()); - let mut pending = Vec::with_capacity(tokens); - for _ in 0..tokens { - pending.push(pair.requests.next().await.unwrap()); - } - let prefix = format!("wait/{generation}/"); - generation += 1; - let broadcasts: Vec<_> = (0..paths) - .map(|path| { - let broadcast = publish - .route( - format!("{prefix}{path}").as_str(), - moq_net::origin::RouteOptions::hidden(), - ) - .unwrap(); - broadcast.announce().unwrap(); - broadcast - }) - .collect(); - // Let the session reach its admission wait before the final reply widens it. - tokio::task::yield_now().await; - let mut issued = Vec::with_capacity(tokens); - for (index, request) in pending.into_iter().enumerate() { - issued.push(request.accept(if index + 1 == tokens { - auth::Grant::all() - } else { - auth::Grant::default() - })); - } - let tokens: Vec<_> = presenting.await.into_iter().map(Result::unwrap).collect(); - let mut announced = receive.consume().routes(); - let mut seen = std::collections::HashSet::new(); - while seen.len() < paths { - match announced.next().await.unwrap() { - moq_net::origin::RouteEvent { - kind: - moq_net::origin::RouteKind::Start - | moq_net::origin::RouteKind::Update - | moq_net::origin::RouteKind::Restart, - announce: update, - } if update.prefix.as_str().starts_with(&prefix) => { - seen.insert(update.prefix); - } - _ => {} + let mut group = c.benchmark_group(format!("auth/waiting/{INBAND}")); + group.sample_size(10); + group.warm_up_time(Duration::from_millis(100)); + group.measurement_time(Duration::from_millis(300)); + for tokens in [1, 16, 128] { + for paths in [1, 16, 128] { + group.throughput(Throughput::Elements(paths as u64)); + group.bench_with_input( + BenchmarkId::new(tokens.to_string(), paths), + &(tokens, paths), + |b, &(tokens, paths)| { + let _guard = runtime.enter(); + let mut config = origin::Config::new(std::num::NonZeroU64::new(2).unwrap()); + config.update_hold = Duration::ZERO; + let (publish, driver) = origin::Producer::new(config); + harness::spawn(driver); + let (receive, driver) = + origin::Producer::new(origin::Config::new(std::num::NonZeroU64::new(1).unwrap())); + harness::spawn(driver); + let mut pair = runtime.block_on(pair(Some(Origins { + publish: &publish, + subscribe: receive.clone(), + }))); + let mut generation = 0; + b.iter(|| { + runtime.block_on(async { + let handle = pair.client.auth(); + let mut presenting = std::pin::pin!(join_all((0..tokens).map(|_| handle.add("pending")))); + assert!(futures::poll!(presenting.as_mut()).is_pending()); + let mut pending = Vec::with_capacity(tokens); + for _ in 0..tokens { + pending.push(pair.requests.next().await.unwrap()); + } + let prefix = format!("wait/{generation}/"); + generation += 1; + let broadcasts: Vec<_> = (0..paths) + .map(|path| { + let broadcast = publish + .route( + format!("{prefix}{path}").as_str(), + moq_net::origin::RouteOptions::hidden(), + ) + .unwrap(); + broadcast.announce().unwrap(); + broadcast + }) + .collect(); + // Let the session reach its admission wait before the final reply widens it. + tokio::task::yield_now().await; + let mut issued = Vec::with_capacity(tokens); + for (index, request) in pending.into_iter().enumerate() { + issued.push(request.accept(if index + 1 == tokens { + auth::Grant::all() + } else { + auth::Grant::default() + })); + } + let tokens: Vec<_> = presenting.await.into_iter().map(Result::unwrap).collect(); + let mut announced = receive.consume().routes(); + let mut seen = std::collections::HashSet::new(); + while seen.len() < paths { + match announced.next().await.unwrap() { + moq_net::origin::RouteEvent { + kind: + moq_net::origin::RouteKind::Start + | moq_net::origin::RouteKind::Update + | moq_net::origin::RouteKind::Restart, + announce: update, + } if update.prefix.as_str().starts_with(&prefix) => { + seen.insert(update.prefix); } + _ => {} } - drop(broadcasts); - drop(tokens); - join_all(issued.iter().map(auth::Issued::closed)).await; - }) - }); - }, - ); - } + } + drop(broadcasts); + drop(tokens); + join_all(issued.iter().map(auth::Issued::closed)).await; + }) + }); + }, + ); } - group.finish(); } + group.finish(); } /// Request-token lookup and shared withdrawal, sweeping distinct tokens and naming requests.