diff --git a/quest/m1/README.md b/quest/m1/README.md index 35d86047a53..d5d3d1d0b99 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -69,7 +69,6 @@ above them. - [Hard fork](/quest/m1/quic/fork/README.md) - quinn hard-forked in-tree as `moq-quic`, ranked ahead of perf; the rest of the QUIC line follows it - [Own the QUIC stack](/quest/m1/quic/README.md) - quinn hard-forked in-tree as `moq-quic`, carrying BBR, reliable reset, hierarchical scheduling, peer limits, and endpoint sharding - [Finalize moq-lite-07](/quest/m1/lite07-finalize.md) - when the maintainer cuts it, lite-07 negotiates as `moq-lite-07` and the next release ships it -- [Interop close logs](/quest/m1/interop-close-log.md) - logging fix landed; delete once the required Interop run is green - [moq-transport passthrough](/quest/m1/ietf-extension/README.md) - subgroups, object IDs, properties, end status, datagram objects, and unknown track properties survive moq-transport -> moq-relay (and a relay cluster) -> moq-transport; moxygen's moq-test passes nightly - [FETCH max-delay](/quest/m1/fetch-max-delay.md) - historical readers obey publisher max-age and an optional tighter reader budget, including while holding a group - [Draft-20 FETCH edge-case backport](/quest/m1/fetch-edge-cases.md) - backport the final-object and response-group fixes to a later 0.17 patch after main lands diff --git a/quest/m1/interop-close-log.md b/quest/m1/interop-close-log.md deleted file mode 100644 index 891b8a123e6..00000000000 --- a/quest/m1/interop-close-log.md +++ /dev/null @@ -1,26 +0,0 @@ -# [XS] The interop idle-out check reads the relay's close log at a fixed level - -## Goal - -The interop harness's idle-out check never misreads a clean close as an open -connection because of the relay's log level. - -## Plan - -Found while merging #5174 (2026-10-10): the relay logs a clean -`connection closed` at info and an error close at warn, and the harness -counts those lines to decide every connection closed. If the interop relay -ever runs at warn, every clean close would read as still open and fail the -round. - -Decided 2026-10-10: pin the harness's relay log filter for the close-log -target to info in `test/interop/interop.sh`, so the product keeps warn for -error closes. Rejected: logging both at one level in moq-relay. Also fail -the round loudly when the relay log shows no connection for it, so a filter -that hides the `conn{id=...}` and close lines can't pass as nothing open. - -Public API: none. Wire: none. - -### Validation remaining - -The implementation and shell regression are complete in [#5215](https://github.com/moq-dev/moq/pull/5215). Full checks and all-language interop pass with inherited `RUST_LOG=warn`. Keep this quest until the required Interop CI is green: hosted TS captured 3.27/20.06 seconds, and the independent current-main local headroom run stops at a PID 256 decode deadline (0.50/20.06 seconds). Neither failure has been attributed to relay-log accounting. Do not weaken duration or deadline checks. The stdin throughput fix in #5292 has merged; delete this quest once the required Interop run passes with it. diff --git a/rs/moq-cli/src/main.rs b/rs/moq-cli/src/main.rs index 9e22ad66c86..2805b345892 100644 --- a/rs/moq-cli/src/main.rs +++ b/rs/moq-cli/src/main.rs @@ -250,11 +250,13 @@ fn spawn_serve(tasks: &mut JoinSet>, mut listener: moq_tokio: let serving = serving.clone(); sessions.spawn(async move { let result = if serving.lan && moq_relay::cluster::Cluster::is_lan_path(request.path()) { + // Logs its own close. moq_relay::Connection::new(request, serving.cluster.clone(), serving.auth.clone()) .with_id(serving.cluster.next_connection_id()) .with_shutdown(serving.shutdown.clone()) .run() - .await + .await; + return; } else if serving.lan && !is_public_transport(request.transport(), serving.public_quic) { tracing::debug!(path = %request.path(), "refusing a non-peer request on the LAN mesh listener"); request.reject(moq_tokio::server::Reject::App(404)).await.ok(); diff --git a/rs/moq-relay/benches/auth.rs b/rs/moq-relay/benches/auth.rs index 138dc1d6750..d8e9d384622 100644 --- a/rs/moq-relay/benches/auth.rs +++ b/rs/moq-relay/benches/auth.rs @@ -63,7 +63,7 @@ impl Fixture { while let Some(request) = server.accept().await { let connection = Connection::new(request, cluster.clone(), auth.clone()); serving.spawn(async move { - let _ = connection.run().await; + connection.run().await; }); } }); diff --git a/rs/moq-relay/src/cluster.rs b/rs/moq-relay/src/cluster.rs index 3009b9ad87c..eb41f63d185 100644 --- a/rs/moq-relay/src/cluster.rs +++ b/rs/moq-relay/src/cluster.rs @@ -3163,7 +3163,7 @@ mod tests { while let Some(request) = listener.accept().await { let conn = crate::Connection::new(request, accept.clone(), crate::auth::Auth::refuse("test")); tokio::spawn(async move { - let _ = conn.run().await; + conn.run().await; }); } }); diff --git a/rs/moq-relay/src/connection.rs b/rs/moq-relay/src/connection.rs index afd501fe2b7..f944205f2c5 100644 --- a/rs/moq-relay/src/connection.rs +++ b/rs/moq-relay/src/connection.rs @@ -1,5 +1,3 @@ -use anyhow::Context; - use crate::{auth, cluster, refusals::Refusal}; use axum::http; @@ -80,15 +78,22 @@ impl Connection { self } - /// Admits and serves this connection until it closes. A panic ends only this - /// connection, as an error. + /// Admits and serves this connection until it closes, then logs the close. A panic + /// ends only this connection, as an error. #[tracing::instrument("conn", skip_all, fields(id = self.id, remote = self.request.remote_addr().map(tracing::field::display), session = tracing::field::Empty))] - pub async fn run(self) -> anyhow::Result<()> { + pub async fn run(self) { + let id = self.id; // Boxed: debug builds copy the session's large future through each wrapper's // stack frame, which overflows a test thread. - moq_tokio::panic::isolate(Box::pin(self.serve())) + let result = moq_tokio::panic::isolate(Box::pin(self.serve())) .await - .context("connection panicked")? + .unwrap_or_else(|| Err(anyhow::anyhow!("connection panicked"))); + // Logged here, under the same target as the span's other lines, so every + // transport's `conn{id=...}` pairs with its close under one log filter. + match result { + Ok(()) => tracing::info!(id, "connection closed"), + Err(err) => tracing::warn!(id, %err, "connection closed"), + } } async fn serve(self) -> anyhow::Result<()> { diff --git a/rs/moq-relay/src/relay.rs b/rs/moq-relay/src/relay.rs index f8dc70cf16c..d44595e2e9b 100644 --- a/rs/moq-relay/src/relay.rs +++ b/rs/moq-relay/src/relay.rs @@ -800,20 +800,11 @@ async fn serve_listening( sessions: crate::session::Registry, ) -> anyhow::Result<()> { while let Some(request) = listener.accept().await { - let id = cluster.next_connection_id(); let conn = Connection::new(request, cluster.clone(), auth.clone()) - .with_id(id) + .with_id(cluster.next_connection_id()) .with_shutdown(shutdown.clone()) .with_sessions(sessions.clone()); - - tokio::spawn(async move { - match conn.run().await { - // A lease or shutdown ending the session closes it too: logged, so every - // accepted connection pairs with its end. - Ok(()) => tracing::info!(id, "connection closed"), - Err(err) => tracing::warn!(id, %err, "connection closed"), - } - }); + tokio::spawn(conn.run()); } anyhow::bail!("stopped accepting connections") diff --git a/rs/moq-relay/src/websocket.rs b/rs/moq-relay/src/websocket.rs index d9b9db44aec..b0932506101 100644 --- a/rs/moq-relay/src/websocket.rs +++ b/rs/moq-relay/src/websocket.rs @@ -79,16 +79,13 @@ pub(crate) async fn serve_ws( return; } }; - // Numbered and logged like a QUIC accept, so every `conn{id=...}` pairs with its close. - let id = state.cluster.next_connection_id(); - let conn = crate::connection::Connection::new(request, state.cluster.clone(), state.auth.clone()) - .with_id(id) + // Numbered like a QUIC accept, so its `conn{id=...}` never reuses a QUIC one's id. + crate::connection::Connection::new(request, state.cluster.clone(), state.auth.clone()) + .with_id(state.cluster.next_connection_id()) .with_shutdown(state.shutdown.clone()) - .with_sessions(state.sessions.clone()); - match conn.run().await { - Ok(()) => tracing::info!(id, "connection closed"), - Err(err) => tracing::warn!(id, %err, "connection closed"), - } + .with_sessions(state.sessions.clone()) + .run() + .await; })) } diff --git a/rs/moq-relay/tests/auth_lifetime.rs b/rs/moq-relay/tests/auth_lifetime.rs index 52face48581..953b31f2d61 100644 --- a/rs/moq-relay/tests/auth_lifetime.rs +++ b/rs/moq-relay/tests/auth_lifetime.rs @@ -160,7 +160,7 @@ async fn spawn_relay_with( let conn = Connection::new(request, cluster.clone(), auth.clone()).with_id(id); id += 1; tokio::spawn(async move { - let _ = conn.run().await; + conn.run().await; }); } }); @@ -345,7 +345,7 @@ async fn spawn_quic_relay_with( while let Some(request) = server.accept().await { let conn = Connection::new(request, cluster.clone(), auth.clone()); tokio::spawn(async move { - let _ = conn.run().await; + conn.run().await; }); } }); diff --git a/rs/moq-relay/tests/goaway_cluster.rs b/rs/moq-relay/tests/goaway_cluster.rs index 27a5135a4e1..726479103b0 100644 --- a/rs/moq-relay/tests/goaway_cluster.rs +++ b/rs/moq-relay/tests/goaway_cluster.rs @@ -445,7 +445,7 @@ async fn spawn_relay_with_upstream( .with_shutdown(moq_relay::shutdown::Observer::disabled()); id += 1; tokio::spawn(async move { - let _ = conn.run().await; + conn.run().await; }); } }); diff --git a/rs/moq-relay/tests/session_revalidate.rs b/rs/moq-relay/tests/session_revalidate.rs index ce96bd0b5cf..40585ba7d65 100644 --- a/rs/moq-relay/tests/session_revalidate.rs +++ b/rs/moq-relay/tests/session_revalidate.rs @@ -179,7 +179,7 @@ impl Fixture { .with_sessions(sessions.clone()); id += 1; tokio::spawn(async move { - let _ = conn.run().await; + conn.run().await; }); } }); diff --git a/rs/moq-relay/tests/smoke.rs b/rs/moq-relay/tests/smoke.rs index 7cfd1674964..8844810d889 100644 --- a/rs/moq-relay/tests/smoke.rs +++ b/rs/moq-relay/tests/smoke.rs @@ -259,11 +259,16 @@ impl tracing_subscriber::fmt::MakeWriter<'_> for Logs { /// a QUIC one, so the interop harness can pair its `conn{id=N}` span with that close. #[tokio::test] async fn relay_websocket_logs_its_close_under_a_cluster_id() { + use tracing_subscriber::layer::SubscriberExt; + let logs = Logs::default(); + // Only the connection target, as the interop harness keeps, so the span and its close + // must both log there. let subscriber = tracing_subscriber::fmt() .with_ansi(false) .with_writer(logs.clone()) - .finish(); + .finish() + .with(tracing_subscriber::filter::Targets::new().with_target("moq_relay::connection", tracing::Level::INFO)); // Thread-local, which covers the relay: the test's current-thread runtime runs its tasks. let _logging = tracing::subscriber::set_default(subscriber); @@ -704,7 +709,7 @@ async fn spawn_accept_relay( .with_shutdown(moq_relay::shutdown::Observer::disabled()); id += 1; tokio::spawn(async move { - let _ = conn.run().await; + conn.run().await; }); } }); diff --git a/rs/moq-relay/tests/upstream_links.rs b/rs/moq-relay/tests/upstream_links.rs index 4a0ebbee03a..2d08a0270af 100644 --- a/rs/moq-relay/tests/upstream_links.rs +++ b/rs/moq-relay/tests/upstream_links.rs @@ -121,7 +121,7 @@ async fn node(id: u64, connect: Vec) -> Node { while let Some(request) = listener.accept().await { let connection = Connection::new(request, serving.clone(), auth.clone()); sessions.spawn(async move { - let _ = connection.run().await; + connection.run().await; }); } }); diff --git a/test/interop/relay-log.sh b/test/interop/relay-log.sh index 09b4eed71db..833c1ca1ea9 100644 --- a/test/interop/relay-log.sh +++ b/test/interop/relay-log.sh @@ -9,7 +9,7 @@ relay_log_since() { # Print each relay connection opened from log line FROM on, with how it closed: the # relay's close error, "ended" for a close without one, or "open" while it hasn't closed yet. # The patterns follow the relay's `conn{id=...}` span and its `connection closed` log -# (`rs/moq-relay/src/relay.rs`). The relay numbers connections in accept order, so an id at +# (`rs/moq-relay/src/connection.rs`). The relay numbers connections in accept order, so an id at # or below the highest one logged before FROM was opened earlier: a straggler from an earlier # round that logs or idles out here isn't blamed on this one. relay_connections() {