diff --git a/bench/ffi-gen/Cargo.lock b/bench/ffi-gen/Cargo.lock index c058556a08f..2f3916bc6e2 100644 --- a/bench/ffi-gen/Cargo.lock +++ b/bench/ffi-gen/Cargo.lock @@ -1409,9 +1409,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.104" +version = "0.3.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a" +checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" dependencies = [ "cfg-if", "futures-util", @@ -3280,9 +3280,9 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasm-bindgen" -version = "0.2.127" +version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70" +checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" dependencies = [ "cfg-if", "once_cell", @@ -3293,19 +3293,20 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.77" +version = "0.4.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7777d5cc23d0e91404e53ce2d5e8ec7acae3026b16233dba62cd3246457950" +checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" dependencies = [ "js-sys", + "tokio", "wasm-bindgen", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.127" +version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1" +checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3313,22 +3314,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.127" +version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284" +checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.119", + "syn 3.0.6", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.127" +version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf" +checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" dependencies = [ "unicode-ident", ] @@ -3360,9 +3361,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.104" +version = "0.3.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c435338968042f4f59a557f690a253676d47ce13ceb55d70100e7facf6620a30" +checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/quest/m0/README.md b/quest/m0/README.md index 7606ab224fd..6b14f225f7e 100644 --- a/quest/m0/README.md +++ b/quest/m0/README.md @@ -95,7 +95,6 @@ Each lands its fixes in its own PR and plans only what needs a decision. - [Broadcast epochs](/quest/m0/broadcast-epoch/README.md) - every first-party publisher that can restart mints a fresh route epoch, the newest wins a path, and only routes with the same epoch resume a subscription - [Performance audit](/quest/m0/audit-perf.md) - benchmarks that regressed since the last run are explained, fixed, or planned, and unbenched hot paths get coverage - [Compile time audit](/quest/m0/audit-compile-time.md) - build-time hotspots are measured against a baseline and the worst are fixed or planned -- [Test and CI cost audit](/quest/m0/audit-test-cost.md) - the slowest, flakiest, and least valuable tests and CI jobs are fixed, deleted, or planned - [Documentation audit](/quest/m0/audit-docs.md) - stale pages, examples, links, and undocumented exports are fixed or planned - [Dependency and alternatives audit](/quest/m0/audit-deps.md) - dependencies are current, deduplicated, needed, and the best maintained option - [Artifact size audit](/quest/m0/audit-size.md) - binary, FFI, WASM, and bundle growth since the last run is explained, fixed, or planned diff --git a/quest/m0/audit-perf.md b/quest/m0/audit-perf.md index 520476a78c0..474eb12c96a 100644 --- a/quest/m0/audit-perf.md +++ b/quest/m0/audit-perf.md @@ -69,9 +69,10 @@ Audit evidence (2026-10-19, second checkpoint, incomplete): nights; its -12% on small frames sits inside that band, and both nights used Dart 3.13.0 (the nixpkgs bump `4109d3893` did not change it). No binding regression is established. Recheck Dart against `gh-pages`. -- JS: the Nightly JS leg is cancelled at one hour by the forward fixture, - which [the test-cost audit](/quest/m0/audit-test-cost.md) is fixing. Until - it lands there is no JS history. Nightly never runs these JS benches: +- JS: the Nightly JS leg was cancelled at one hour by the forward fixture, + which the test-cost audit fixed in + [#5976](https://github.com/moq-dev/moq/pull/5976). Until a Nightly runs + with it there is no JS history. Nightly never runs these JS benches: net `observed`; json `codec` and `parse`; hang `slow-group`; watch `warmup`; clock `timers` (`qmux` and `serve-browser` run, uncharted, in the audio-quality job). Add them, with an inventory test like the Rust diff --git a/quest/m0/audit-test-cost.md b/quest/m0/audit-test-cost.md deleted file mode 100644 index ed075f7ab91..00000000000 --- a/quest/m0/audit-test-cost.md +++ /dev/null @@ -1,85 +0,0 @@ -# [M] Test and CI cost audit - -## Goal - -The slowest, flakiest, and least valuable tests and CI jobs are sped up, fixed, -deleted, or planned, so the suite costs what it earns. - -## Plan - -Recurs once per major release (decided 2026-10-19). The PR that finishes -this run also adds the next one with the same file name at the end of the next -milestone's `Required` (m0 to m1, m1 to m2). The successor keeps the Goal -and this paragraph; the rest of its Plan is rewritten with what this run -learned: baselines, results, and what to check first. A successor placed in m2 -also lists the [release cut](/quest/m2/release/cut.md) under `Required`, so it -waits for the release in flight to ship. Only `/quest-delete` ends the -recurrence. Fixes land in the run's PR, one commit each, rather than as follow-ups. -Only a change that needs a maintainer decision (public API, scope) or is -independently landable and too large to review alongside the rest becomes a -follow-up through `/quest-plan`. - -Use nextest's normal CI log to rank the slowest tests (`slow-timeout` is 30s). -Flakes are tracked by hand in [test flakes](/quest/m1/test-flakes-2/README.md), -and `retries = 0` is deliberate. Mine nightly and merge-queue failures since -the previous run with `gh run list` for new ones. A test that sleeps on the -wall clock should mock time (AGENTS.md). Delete tests whose coverage another -test already provides. Rank CI jobs by duration. [CI cost and -latency](/quest/m0/ci/README.md) owns runner and cache infrastructure. While -the one-time [CI pipeline audit](/quest/m0/ci/audit.md) is open it owns -job-level costs and compile waste, and this run ranks individual tests; -later runs pick job costs back up. - -Audit in progress (2026-10-19): Nightly runs -[39266265648](https://github.com/moq-dev/moq/actions/runs/39266265648) and -[39124936449](https://github.com/moq-dev/moq/actions/runs/39124936449) both -spent their full hour in JS benchmarks. The forward fixture never completed -its fake peer's initial set, making every watcher repeatedly compare every -pending scope. It also let the real two-second discovery linger expire while -measuring setup. Syncing the empty peer and holding logical time fixed makes -the full 8/128/2048 watches by 1/8/32 sessions sweep finish with its existing -cost checks. The original production implementation passes that repaired -benchmark; no production optimization is needed. - -The same nights exposed a stale exhaustive-feature count in the CI selection -test after WebRTC was added. Its Bash fixture also assumed `/bin/bash`, -which breaks on NixOS. The stats producer benchmark needs the same documented -real-clock lint exemption as its neighboring decode and aggregate benchmarks. -The unused stats benchmark import is separately fixed by the dead-code audit. - -Queue run [39216656008](https://github.com/moq-dev/moq/actions/runs/39216656008) -records 7,227 passing test durations before failing. The longest passes were -the CLI restart/stitch case (19.14s), same-instance linger (17.77s), impaired -flapping-peer drill (16.89s), TS source-limit timing (15.13s), and one-day -jitter drift simulation (14.93s). These cover different behaviors; no test -retirement is justified by this sample. - -Remaining investigation: that queue run's -`acme::tests::failed_validations_stop_short_of_the_rate_limit` failed its -30-second watchdog at `rs/moq-relay/src/acme/tests.rs:576`. These tests use -real sockets and rustls-acme's wall-clock polling. The cause is not established; -do not extend the watchdog or substitute paused Tokio time around real I/O. -The selected branch check passed this case in 6.16s without reproducing it. -Keep this run open until that failure is reproduced and fixed or scoped into -an independently reviewable investigation. Do not advance the recurrence yet. - -Other costly Nightly jobs in the October 18-19 sample included macOS -platform coverage (56-57 minutes), binding benchmarks (43-57 minutes), Rust -bench targets (40-51 minutes), and audio quality (47-60 minutes). Their work -differs and belongs outside the PR gate; runner/cache changes stay with the -CI epic. Queue run -[39287133351](https://github.com/moq-dev/moq/actions/runs/39287133351) failed -the Python clock test with `Old`: -[moq-dev/moq#5944](https://github.com/moq-dev/moq/pull/5944) made an expired group fail its pending -first-frame read. [moq-dev/moq#5962](https://github.com/moq-dev/moq/pull/5962) -restored the skip to the later group, so the test keeps its original assertion. - -The branch check also shows a scoping cost worth measuring next: a JS net -benchmark-only edit selects WASM and the net dependents, while a stats -benchmark-only edit selects relay/CLI tests, docs, and CLI's optional play -build. Compare that cost with the regression signal before changing selection. - -Verified locally: `just check`, the full forward benchmark sweep, the 8 CI -selection tests, and targeted stats producer-benchmark Clippy. The stats -benchmark check temporarily used the dead-code audit's import cleanup; that -prerequisite is excluded from this PR. diff --git a/quest/m0/ci/audit.md b/quest/m0/ci/audit.md index 3d40708ea03..fad431be6e6 100644 --- a/quest/m0/ci/audit.md +++ b/quest/m0/ci/audit.md @@ -6,7 +6,7 @@ Every merge queue and nightly job is timed, and every expensive step either earns its minutes or is cut, moved or planned. The Rust cache reuses unchanged crates, and CI compiles nothing it doesn't need. Fixes land in this quest's PR, one commit each. Ranking individual tests stays with the -recurring [test cost audit](/quest/m0/audit-test-cost.md). +recurring [test cost audit](/quest/m1/audit-test-cost.md). ## Plan diff --git a/quest/m1/README.md b/quest/m1/README.md index 947b674d5d4..c04d1716770 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -125,8 +125,11 @@ lands before the cut. - [C++ and OBS package proof](/quest/m1/cpp-package-check.md) - the installed artifacts pass before their first release +- [Nightly media players](/quest/m1/media-engines-nightly.md) - the Firefox and WebKit player rows pass, or an engine that cannot play leaves the nightly matrix + - [Dead code and API surface audit](/quest/m1/audit-dead-code.md) - repeat the removal audit before the next major release - [Test coverage audit](/quest/m1/audit-test-coverage.md) - repeat the coverage audit against the m0 baselines before the next major release +- [Test and CI cost audit](/quest/m1/audit-test-cost.md) - the slowest, flakiest, and least valuable tests and CI jobs are fixed, deleted, or planned ## Related diff --git a/quest/m1/audit-test-cost.md b/quest/m1/audit-test-cost.md new file mode 100644 index 00000000000..fec36b1f156 --- /dev/null +++ b/quest/m1/audit-test-cost.md @@ -0,0 +1,73 @@ +# [M] Test and CI cost audit + +## Goal + +The slowest, flakiest, and least valuable tests and CI jobs are sped up, fixed, +deleted, or planned, so the suite costs what it earns. + +## Plan + +Recurs once per major release (decided 2026-10-19). The PR that finishes +this run also adds the next one with the same file name at the end of the next +milestone's `Required` (m0 to m1, m1 to m2). The successor keeps the Goal +and this paragraph; the rest of its Plan is rewritten with what this run +learned: baselines, results, and what to check first. A successor placed in m2 +also lists the [release cut](/quest/m2/release/cut.md) under `Required`, so it +waits for the release in flight to ship. Only `/quest-delete` ends the +recurrence. Fixes land in the run's PR, one commit each, rather than as follow-ups. +Only a change that needs a maintainer decision (public API, scope) or is +independently landable and too large to review alongside the rest becomes a +follow-up through `/quest-plan`. + +Use nextest's normal CI log to rank the slowest tests (`slow-timeout` is 30s). +Flakes are tracked by hand in [test flakes](/quest/m1/test-flakes-2/README.md), +and `retries = 0` is deliberate. A test that sleeps on the wall clock should +mock time (AGENTS.md). Delete tests whose coverage another test already +provides. [CI cost and latency](/quest/m0/ci/README.md) owns runner and cache +infrastructure. Once the one-time [CI pipeline audit](/quest/m0/ci/audit.md) +closes, this audit ranks job costs again. + +What the m0 run (2026-10-19) learned; check these first: + +- Classify every failed job of the latest Nightly, scheduled Interop, and + Platform runs, not just the slowest. The m0 run's first checkpoint looked + mainly at the Nightly's stalled JS benchmarks, while 28 Nightly jobs had + failed for eight independent causes, some for days. A red Nightly hides the + next regression: the send-depth gate and all six fuzz targets broke on + 2026-10-18 and stayed broken unnoticed until this audit. +- Platform (macOS, Windows) runs only in the merge queue and is not required, + so a Windows-only compile error in moq-video stayed red for two days across + dozens of queue runs until + [#5966](https://github.com/moq-dev/moq/pull/5966). Most Platform failures + in the sample were that error, a choco `nasm` install outage, or another + queued PR's breakage. Rank Platform by failure cause, not count. +- A queue failure often belongs to another PR in the same batch: a stale + fixture in the entry itself, or a semantic conflict with a PR merged after it + was queued. Check the entry's head branch and what merged around it before + calling it a flake. +- Fixed by the m0 run: the ACME rate-limit test's released port, the stats + session graph's recursive Send proof (send-depth and fuzz), bench/ffi-gen's + stale wasm-bindgen lock, moq-uring's fixed 1 ms calibration slack, the + Nightly JS benchmark stall, the CI selection test's feature count, and the + stats producer benchmark lint. +- Planned by the m0 run: [redundant failover drift](/quest/m1/test-flakes-2/redundant-failover-drift.md), + [macOS QUIC connects](/quest/m1/test-flakes-2/macos-quic-connect.md), and + [nightly media players](/quest/m1/media-engines-nightly.md). Owned + elsewhere: release builds by [release builds link](/quest/m0/release-link.md), + Rust advisories by the dependency audit, and the Nix wasm-bindgen pin by + [Cargo.lock pins wasm-bindgen](/quest/m0/ci/wasm-bindgen-pin.md). + +Baselines from queue run +[39371990135](https://github.com/moq-dev/moq/actions/runs/39371990135): +Test took 17 min and Check 15 min; nextest ran 7,657 tests in 220 s. The +slowest were the three new redundant-importer exports (37, 29 and 15 s, +waiting out a killed importer's 10 s QUIC idle timeout), the CLI +restart/stitch case (18.6 s), same-instance linger (17.5 s), TS source-limit +timing (16.5 s), the impaired flapping-peer drill (16.4 s), and the one-day +jitter drift simulation (14.7 s). Apart from the redundant exports, the +leaders match the earlier sample and cover different behaviors. + +Still to measure: a JS net benchmark-only edit selects WASM and the net +dependents, and a stats benchmark-only edit selects relay and CLI tests, docs, +and CLI's optional play build. Compare that cost with the regression signal +before changing selection. diff --git a/quest/m1/media-engines-nightly.md b/quest/m1/media-engines-nightly.md new file mode 100644 index 00000000000..b613fdfc4d4 --- /dev/null +++ b/quest/m1/media-engines-nightly.md @@ -0,0 +1,38 @@ +# [S] Nightly media players pass on Firefox and WebKit, or leave the matrix + +## Goal + +Nightly's `Media (firefox player)` and `Media (webkit player)` jobs pass, or +an engine that cannot play the fixture leaves the matrix with its limit +recorded. Neither has passed since +[#5640](https://github.com/moq-dev/moq/pull/5640) added them on 2026-10-16, +so every nightly is red for a known cause and hides new failures. + +## Plan + +Found by the 2026-10-19 test cost audit; the same failure each night +(for example [webkit](https://github.com/moq-dev/moq/actions/runs/39266265648/job/118106525118) +and [firefox](https://github.com/moq-dev/moq/actions/runs/39266265648/job/118106525416)): + +- WebKit 26.6 and 27.2 fail the capability check: "cannot run player: + missing decode avc1.42001f, decode vp8, decode opus". Every row then fails. + Playwright's Linux WebKit is not Safari, so this looks like a limit of the + build rather than a player bug. #5640 left exactly this call open. +- Firefox 157 fails each row at "gesture starts audio: waiting for the audio + graph to resume after a user gesture". #5640 saw this locally once and + could not reproduce it on a host with an audio server; the arm runner may + have none. + +Open decision for WebKit, recommended first: + +1. Drop it from the nightly matrix and record the missing decoders, since a + row that cannot pass measures nothing. Real Safari coverage stays with + [WebGPU on Safari](/quest/m1/webgpu-safari.md) and manual runs. +2. Keep it and report the capability gap without failing the job, which + contradicts the harness's fail-by-name rule. + +For Firefox, reproduce on an arm runner image first. If the cause is the +missing audio device, give the job one (for example a null PulseAudio sink) +rather than relaxing the gesture check. + +Public API: none. Wire: none. diff --git a/quest/m1/test-flakes-2/README.md b/quest/m1/test-flakes-2/README.md index 1241652fb1d..1945eca575c 100644 --- a/quest/m1/test-flakes-2/README.md +++ b/quest/m1/test-flakes-2/README.md @@ -32,15 +32,19 @@ times on a loaded machine, as the first round did. moq-tokio's known exception, tracked by [Readers see SUBSCRIBE_DROP](/quest/m1/subscribe-drop-errors.md). Added 2026-10-19 (maintainer): three more, the redial pair first since CI -hit it. +hit it. The same day's test cost audit added the macOS QUIC connects, and the +redundant failover drift first: it may hide a TS export bug and failed two of +three loaded `just check` runs. Public API: none. Wire: none. ## Required +- [Redundant failover drift](/quest/m1/test-flakes-2/redundant-failover-drift.md) - a stitching TS export switches back to the surviving importer behind bufferbloat instead of failing on a stalled clock - [moq-tokio redial tests](/quest/m1/test-flakes-2/tokio-redial.md) - the two redial tests stop assuming a dropped port stays free and stop racing 10 s deadlines - [moq-ffi cancel during connect](/quest/m1/test-flakes-2/ffi-cancel-connect.md) - `client_cancel_aborts_a_pending_connect` orders its cancel deterministically, fixing the code if the race is real - [Flapping-peer reorder seed](/quest/m1/test-flakes-2/flapping-peer-reorder.md) - replay one drill seed on current main, and fix it or delete the quest +- [macOS QUIC connects](/quest/m1/test-flakes-2/macos-quic-connect.md) - moq-tokio's loopback QUIC tests stop timing out on the macOS Platform job ## Related diff --git a/quest/m1/test-flakes-2/macos-quic-connect.md b/quest/m1/test-flakes-2/macos-quic-connect.md new file mode 100644 index 00000000000..49bc8272e59 --- /dev/null +++ b/quest/m1/test-flakes-2/macos-quic-connect.md @@ -0,0 +1,37 @@ +# [S] moq-tokio QUIC connects hold up on macOS + +## Goal + +moq-tokio's loopback QUIC tests pass reliably on the macOS Platform job. +Recent queue runs failed there while the same tests pass on Linux: + +- `close_code::abort_then_drop` (`rs/moq-tokio/tests/integration/close_code.rs:91`), + "the connection did not close: Elapsed", in + [run 39302614921](https://github.com/moq-dev/moq/actions/runs/39302614921/job/118231847253), + whose PR only touched Windows video code. +- `client::tests::fixed_target_preserves_request_and_refuses_redirect` + (`rs/moq-tokio/src/client.rs:860`), "QUIC failed: timed out" after 10 s + against a pinned `127.0.0.1` server, in + [run 39344768657](https://github.com/moq-dev/moq/actions/runs/39344768657/job/118377253144), + whose PR only touched JS dependencies. +- `close_code::reject` at the same line in + [run 39099065494](https://github.com/moq-dev/moq/actions/runs/39099065494/job/117591454363), + on a PR that changed moq-quic's close path, so it may be that PR's own failure. + +## Plan + +Found by the 2026-10-19 test cost audit. On Linux, 30 stressed runs of each +test passed (120 total), so the cause is macOS-specific or load-specific. + +Both shapes are a QUIC handshake to a loopback server that never completes. +`close_code` dials `localhost`, which resolves to `::1` as well as the +`127.0.0.1` the server binds, so first rule out an address race that waits +on the unbound `::1`. `fixed_target` dials `127.0.0.1` directly, so that +does not explain it. Next suspects: macOS UDP socket options (GSO, ECN, +receive buffer) dropping the client's Initial, then a lost Initial waiting +out the handshake timeout. + +Reproduce on macOS with the job's `just` recipe in a loop before changing +anything. Per the epic's rules, never raise the 10 s bounds or add a retry. + +Public API: none. Wire: none. diff --git a/quest/m1/test-flakes-2/redundant-failover-drift.md b/quest/m1/test-flakes-2/redundant-failover-drift.md new file mode 100644 index 00000000000..4701cd08ee6 --- /dev/null +++ b/quest/m1/test-flakes-2/redundant-failover-drift.md @@ -0,0 +1,41 @@ +# [S] Redundant TS failover survives a killed importer behind bufferbloat + +## Goal + +moq-cli's `export::redundant_importers_switch_through_bufferbloat_on_lite_07` +(`rs/moq-cli/tests/integration/export.rs`) passes reliably, fixed at its +cause. On current main it failed 3 of 10 isolated local runs and 2 of 3 +loaded `just check` runs with "stitching export exited". It is also the +slowest test in the queue suite (37 s, past nextest's 30 s SLOW mark). + +## Plan + +Found by the 2026-10-19 test cost audit, with the exporter's stderr captured +on a failing run. After the test kills the newest importer, the exporter +fails instead of switching back to the survivor: + +> export failed with the broadcast still up, so not lingering ... the +> source's clock runs -6129221.2 ppm off ours, past the 30 ppm the output's may follow + +A killed importer sends no close, so the relay keeps its route until the QUIC +idle timeout (10 s by default). The viewer meanwhile gets no media; behind the +160 kbit/s shaper the backlog adds to that stall. The jitter clock in +`rs/moq-mux/src/jitter.rs` charges the stall to source drift and gives up +once it has cost half the delay. The unshaped sibling shows the same stall as +an 11 s output gap at its second switch, but passes. + +Decide which side is wrong before changing the test, recommended first: + +1. The jitter clock should not read a stalled source as drift. A stall is + missing media, which the follower can wait out or switch away from. +2. The follower should switch to the live survivor once the stalled route's + media is stale, without waiting for the relay to drop the route. +3. Both are right, and the export legitimately fails behind a link below the + media rate. Then the test's scenario needs another shape. + +Giving the importers `--quic-idle-timeout 2s --quic-keep-alive 500ms` +passed 5 of 5 runs and cut the three redundant-importer tests from 15, 29 and +37 s to 4, 16 and 30 s. That only shortens the stall, so land it after the +cause is fixed, not instead of it. + +Public API: none. Wire: none. diff --git a/rs/moq-net/src/stats.rs b/rs/moq-net/src/stats.rs index d494804c29e..7a53f7b8430 100644 --- a/rs/moq-net/src/stats.rs +++ b/rs/moq-net/src/stats.rs @@ -138,7 +138,7 @@ use std::{ use kio::Lock; use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use crate::{AsPath, PathOwned, Pattern, Patterns}; +use crate::{AsPath, PathOwned, Pattern, Patterns, util::SendCell}; mod outcomes; pub use outcomes::{Failure, Failures, Refusal, Refusals}; @@ -1344,7 +1344,7 @@ impl Handle { presence.bytes().join(traffic.clone(), (0, 0)); } Session { - inner: Some(Arc::new(SessionInner { + inner: Some(SendCell::new(Arc::new(SessionInner { registry: self.stats.clone(), connected: matches!(context, Context::Session), current: Mutex::new(Current { @@ -1358,7 +1358,7 @@ impl Handle { viewers: Mutex::new(HashMap::new()), held: Mutex::new(Vec::new()), wire: Mutex::new(Vec::new()), - })), + }))), } } } @@ -1383,7 +1383,7 @@ pub struct Wire { } struct WireInner { - session: Arc, + session: SendCell>, counters: crate::transport::Wire, last: Mutex, } @@ -1477,7 +1477,11 @@ impl Side { #[derive(Clone, Default)] pub struct Session { /// `None` for the no-op context (disabled registry or a `default()` handle). - inner: Option>, + /// + /// The context and its wire counters reference each other, so every future + /// holding a context would repeat that recursive Send proof; [`SendCell`] + /// checks it once here. + inner: Option>>, } /// Which of a session's `crate::session::Limits` a [`Session::hold`] counts against. diff --git a/rs/moq-relay/src/acme/tests.rs b/rs/moq-relay/src/acme/tests.rs index 4f94bc82434..2c1c2ed9e25 100644 --- a/rs/moq-relay/src/acme/tests.rs +++ b/rs/moq-relay/src/acme/tests.rs @@ -449,6 +449,22 @@ impl Running { } } +/// A port that refuses every connection for as long as the socket lives. +/// +/// Bound but never listening, so a dial is refused at once. A released port +/// would instead be free for another test process to bind, and a listener +/// there that never answers stalls the dial past every budget. +fn refusing() -> (tokio::net::TcpSocket, SocketAddr) { + let socket = tokio::net::TcpSocket::new_v4().unwrap(); + socket.bind("127.0.0.1:0".parse().unwrap()).unwrap(); + let addr = socket.local_addr().unwrap(); + assert!( + std::net::TcpListener::bind(addr).is_err(), + "no other listener can take the refusing port" + ); + (socket, addr) +} + fn fingerprint(leaf: &CertificateDer<'_>) -> String { hex::encode(aws_lc_rs::digest::digest(&aws_lc_rs::digest::SHA256, leaf)) } @@ -529,11 +545,8 @@ async fn restart_reuses_only_a_matching_cache() { /// domain and the HTTPS listener. #[tokio::test] async fn unreachable_directory_fails_inside_the_budget() { - let closed = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); - let url: Url = format!("http://{}/directory", closed.local_addr().unwrap()) - .parse() - .unwrap(); - drop(closed); + let (_refusing, closed) = refusing(); + let url: Url = format!("http://{closed}/directory").parse().unwrap(); let dir = tempfile::tempdir().unwrap(); let mut config = relay_config(&url, dir.path(), &[DOMAIN]); let budget = Duration::from_secs(2); @@ -562,10 +575,9 @@ async fn unreachable_directory_fails_inside_the_budget() { #[tokio::test] async fn failed_validations_stop_short_of_the_rate_limit() { let directory = Directory::start(false).await; - // Nothing listens here, so every validation fails like an unforwarded port 443. - let closed = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); - *directory.state.target.lock().unwrap() = Some(closed.local_addr().unwrap()); - drop(closed); + // Every validation is refused, like an unforwarded port 443. + let (_refusing, closed) = refusing(); + *directory.state.target.lock().unwrap() = Some(closed); let dir = tempfile::tempdir().unwrap(); let start = || async { let mut config = relay_config(&directory.url, dir.path(), &[DOMAIN]); diff --git a/rs/moq-uring/src/clock.rs b/rs/moq-uring/src/clock.rs index 0881c88d0d0..095efd66118 100644 --- a/rs/moq-uring/src/clock.rs +++ b/rs/moq-uring/src/clock.rs @@ -144,12 +144,14 @@ mod tests { /// monotonic clock from another origin. #[test] fn host_tracks_moq_clock() { + // Off by at most the gap between the two calibration reads, which a + // preemption can stretch, so measure it rather than assume one. + let start = monotonic(); let host = Host::calibrate(); + let slack = monotonic() - start; let before = moq_clock::now(); let now = host.now(); let after = moq_clock::now(); - // Off by at most the gap between the two calibration reads. - let slack = Duration::from_millis(1); assert!( before <= now + slack && now <= after + slack, "{before:?} <= {now:?} <= {after:?}"