Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 0 additions & 26 deletions quest/m1/interop-close-log.md

This file was deleted.

4 changes: 3 additions & 1 deletion rs/moq-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,13 @@ fn spawn_serve(tasks: &mut JoinSet<anyhow::Result<()>>, 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();
Expand Down
2 changes: 1 addition & 1 deletion rs/moq-relay/benches/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion rs/moq-relay/src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}
});
Expand Down
19 changes: 12 additions & 7 deletions rs/moq-relay/src/connection.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use anyhow::Context;

use crate::{auth, cluster, refusals::Refusal};

use axum::http;
Expand Down Expand Up @@ -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<()> {
Expand Down
13 changes: 2 additions & 11 deletions rs/moq-relay/src/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
15 changes: 6 additions & 9 deletions rs/moq-relay/src/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}))
}

Expand Down
4 changes: 2 additions & 2 deletions rs/moq-relay/tests/auth_lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}
});
Expand Down Expand Up @@ -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;
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion rs/moq-relay/tests/goaway_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion rs/moq-relay/tests/session_revalidate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl Fixture {
.with_sessions(sessions.clone());
id += 1;
tokio::spawn(async move {
let _ = conn.run().await;
conn.run().await;
});
}
});
Expand Down
9 changes: 7 additions & 2 deletions rs/moq-relay/tests/smoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion rs/moq-relay/tests/upstream_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ async fn node(id: u64, connect: Vec<Peer>) -> 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;
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion test/interop/relay-log.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Loading