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
2 changes: 2 additions & 0 deletions quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ disabled rung strands WHEP, HLS, and moq-mux export viewers.
- [Scope track priority](/quest/m1/track-priority-scope.md) - priority orders one owner's streams, and a shared cluster session is fair across tenants
- [BBR ACK cleanup](/quest/m1/bbr-ack-cleanup.md) - packet bookkeeping scales with completed entries instead of scanning the flight on every ACK
- [Perf](/quest/m1/perf/README.md) - eliminate measured hot-path costs across moq-uring, kio, and the moq-net model
- [io_uring CI](/quest/m1/uring-ci.md) - PRs touching io_uring code run `just rs uring` on a 6.12+ kernel runner
- [Benchmark regressions in CI](/quest/m1/bench-ci.md) - PRs get a non-blocking comparison of the Criterion benches they affect, and a nightly trend on main alerts on regressions
- [Backport mergeable bench buckets](/quest/m1/bench-buckets.md) - release receives main's per-interval latency buckets and their tests
- [Relay session bench](/quest/m1/bench-relay.md) - the same scenario through moq-relay's own connection handling
Expand All @@ -174,6 +175,7 @@ disabled rung strands WHEP, HLS, and moq-mux export viewers.
- [Route wakes](/quest/m1/route-wakes.md) - a route change wakes only the fronts it can move, so pool churn stops scaling with served paths
- [Publish channel count](/quest/m1/publish-audio-channel-count.md) - forcing a channel count on an Audio.Capture stops costing the subscriber gaps of silence
- [JS request deadline](/quest/m1/js-request-deadline.md) - each JS request, PUBLISH_NAMESPACE included, has one fatal 10 s timer from create to answer and fails fast without stream credit, so nothing queues or retries
- [Handshake deadline covers admission](/quest/m1/handshake-admission-deadline.md) - `listen.timeout` bounds a connection through auth admission on both listeners, replacing the hardcoded admission timeout
- [JS cancellation bench](/quest/m1/js-forget-bench.md) - the requests bench sweeps cancellation over competing dynamic routes, so a per-cancel cost that grows with routes shows as a slope
- [Rust request credit](/quest/m1/rs-request-credit.md) - a moq-net request fails at once without stream credit instead of waiting
- [qmux no-wait opens](/quest/m1/qmux-no-wait.md) - @moq/qmux rejects an over-limit create when waitUntilAvailable is false, like Chrome
Expand Down
74 changes: 74 additions & 0 deletions quest/m1/handshake-admission-deadline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# [M] The handshake deadline covers admission

## Goal

`listen.timeout` bounds a connection from its first packet through auth
admission, on both the tokio and io_uring listeners. A peer that finishes MoQ
SETUP can no longer hold a connection open past the deadline while auth is
pending, and admission has no separate hardcoded bound.

## Plan

Decided 2026-10-13 (from #5244's review, where Codex asked to keep enforcing
the deadline while authorization runs):

- ✅ One deadline through admission. The handshake deadline that already
bounds transport, SETUP and SETUP OK also races `Auth::admit` in
`rs/moq-relay/src/connection.rs` and `rs/moq-relay/src/uring.rs`. On
Comment on lines +15 to +17

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Plan the API needed to reuse the tokio deadline

The tokio path cannot currently perform this race in connection.rs: moq_tokio::server::Request keeps its absolute deadline in a private field (rs/moq-tokio/src/server.rs:1525-1526) and exposes it only indirectly when the consuming ok() applies it (1630-1648), after relay admission has already completed. Preserving the first-packet deadline therefore requires a new public Request operation or another cross-crate refactor, which should be included in the plan and public API impact rather than leaving the implementation to restart a fresh timeout. (Written by GPT-5.6 Sol)

AGENTS.md reference: AGENTS.md:L57-L60

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. 63c8876 adds this as a gap to settle at start, since the method name is an API call. The recommendation is a public Request method that bounds a future by what remains of the deadline, keeping the deadline private and mirrored on io_uring. The plan also says not to start a fresh timeout, and the Public API line lists the new method.

(Written by Claude Opus 5.5)

expiry the session closes with the MoQ timeout code, as for the other
phases.
- `ADMIT_TIMEOUT` (10 s in `rs/moq-relay/src/auth.rs`) stops bounding
admission; a fixed cap that only throws is not a contract. `listen.timeout
= "0"` then waits forever through admission too, as it documents.
Comment on lines +20 to +22

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve bounds for every admission caller

Removing ADMIT_TIMEOUT globally while adding an outer deadline only in connection.rs and uring.rs leaves direct Auth::admit callers unbounded: websocket.rs:68 performs admission before handle_socket starts state.timeout, web.rs:892 admits HTTP requests directly, and the public Cluster::admit uses it for gateway sessions. A stalled decider could therefore retain WebSocket, HTTP, or embedded gateway work forever, even when listen.timeout is nonzero, and this changes public embedding behavior despite the stated “Public API: none.” Preserve a bound for these callers or give each an explicit owning deadline and regression test before deleting the shared cap.

AGENTS.md reference: AGENTS.md:L60-L60

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, the plan missed these callers. dd3f1b3 lists WebSocket, HTTP, and Cluster::admit as a gap to settle at start, recommending the web callers race the same listen.timeout and Cluster::admit document that the embedder owns the deadline. Keeping ADMIT_TIMEOUT as an inner cap was already declined, so it is not offered. The Public API line now notes the behavior change.

(Written by Claude Opus 5.5)

Comment on lines +20 to +22

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Include the HTTP auth client's independent timeout

Removing ADMIT_TIMEOUT does not make listen.timeout = "0" wait indefinitely for an auth server: moq_auth::Client::new also installs a hardcoded 10-second reqwest timeout (rs/moq-auth/src/client.rs:10–34), and Decider::Server uses that client for admission. A server answering after 10 seconds would still be refused with either "0" or a longer handshake budget. Include separating the initial connect request's timeout from bounded post-handshake requests, and test HTTP-backed admission beyond 10 seconds as well as the embedded decider.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. dd3f1b3 adds it: the connect request drops the client's fixed 10 s bound and inherits the caller's deadline, while revalidate and end keep theirs. Tests now include an HTTP auth server answering past 10 s. I also added the note on racing inside the owning task so nothing runs detached.

(Written by Claude Opus 5.5)

Grant renewal in `auth/refresh.rs` keeps its own bound for now; it runs
after the handshake, so `listen.timeout` does not apply.
- Not chosen: keep `ADMIT_TIMEOUT` as an inner cap; a separate
`auth.timeout` config with `listen.timeout` still ending at SETUP.

Start after #5244 (io_uring handshake deadline) merges, since it adds the
io_uring deadline this extends.

Gaps found in this plan's review, to settle with the maintainer at start:

- Dropping the shared cap leaves the other `Auth::admit` callers unbounded:
WebSocket admission before the upgrade (`websocket.rs`), HTTP admission
(`admit_http` in `web.rs`), `serve_client` in `rs/moq-cli/src/main.rs`
for `moq --listen`, and the public `Auth::admit` and `Cluster::admit` for
embedders. Recommendation, following the decision above: the web callers
race the web listener's timeout, which is the same `listen.timeout`;
`moq --listen` races its own listener's `listen.timeout`; and `Auth::admit`
and `Cluster::admit` document that they wait on the decider and the caller
owns the deadline.
- `moq_auth::Client` sets a 10 s reqwest timeout on every request
(`rs/moq-auth/src/client.rs`), so an HTTP auth server answering `connect`
after 10 s is still refused. Only `connect` drops that fixed bound and
inherits the caller's deadline. `attach` (in-band AUTH, which shares the
`connect` path), `revalidate` and `end` run after the handshake and keep
theirs, like grant renewal, so a stalled server cannot pile up requests.
- `moq_tokio::server::Request` keeps its handshake deadline private and
applies it only in `ok()`, after admission, so `connection.rs` cannot race
admission against it today. Recommendation: a public `Request` method that
bounds a future by what remains of the deadline, keeping the deadline itself
private, mirrored on the io_uring request if it has the same shape. Do not
start a fresh timeout at admission; the deadline runs from the first packet.

Race inside the task that owns the admission, or cancel it, so an expired
deadline does not leave admission work running detached.

Tests on controlled time for each caller, the embedded decider and an HTTP
auth server: an admission that never answers closes at the deadline, one
answered just inside it (past 10 s for the HTTP server) is admitted, and
`"0"` waits. At the deadline the HTTP server sees its `connect` request
dropped, so expired admissions leave no in-flight requests behind. An
`attach` to a stalled server is still refused at its bound.
Update `doc/bin/relay/config.md`, which says the deadline covers
"transport through MoQ SETUP", and `doc/bin/relay/auth.md`, which promises
that an embedded admission left unanswered for ten seconds is refused; the
embedder now owns that deadline. Note the behavior change for slow auth
servers in the `moq-relay` and `moq-auth` changelogs.

Public API: a new `moq_tokio::server::Request` method to bound admission by
the handshake deadline. `Auth::admit`, `Cluster::admit` and
`moq_auth::Client::connect` keep their signatures but no longer time out on
their own. Config:
`listen.timeout` now includes admission. Wire: none.
23 changes: 23 additions & 0 deletions quest/m1/uring-ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# [XS] io_uring tests run on PRs

## Goal

A PR touching io_uring code runs `just rs uring` (the io_uring clippy and the
moq-uring and moq-relay nextest runs with the `io-uring` feature), so a
regression there fails the PR instead of the next nightly.

## Plan

Today `rs uring` runs only in `.github/workflows/nightly.yml`, kernel-gated to
6.12 and later. #5244 resolved a merge conflict in `rs/moq-relay/src/uring.rs`
that no PR check compiled.

- Add a PR job path-filtered to `rs/moq-uring/**`, `rs/moq-relay/src/uring*`,
and the shared code they build on, following how other path-filtered PR
workflows in `.github/workflows/` are set up.
- ✅ Decided 2026-10-13: fail loud. The job runs on a runner with a 6.12+
kernel and errors if the kernel is older, rather than skipping. Not chosen:
compile and lint only on PRs, tests nightly.
- Keep the nightly entry unless the PR job covers every path it does.

Public API: none. Wire: none.
Loading