From dda55a64aead5d23f258d806249d89da1dcd97fb Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 7 Nov 2026 00:48:34 -0800 Subject: [PATCH 1/4] chore(quest): claim quest/a1/qmux-rate-filter.md Quest-Claim: 58088d2da0e8dffd From 6ef6c74b29140ca4bd2caf2d62b750c637612d06 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 7 Nov 2026 01:05:00 -0800 Subject: [PATCH 2/4] fix(qmux): filter app-limited send-rate samples Port moq's 10-second windowed maximum, retain the estimate on unusable samples, and decode the Linux app-limited flag for the target byte order. (Written by GPT-6.1 Sol with xhigh) --- quest/a0/qmux-socket-teardown.md | 4 - quest/a1/README.md | 1 - quest/a1/qmux-rate-filter-0.5.md | 4 - quest/a1/qmux-rate-filter.md | 29 ----- quest/a2/quiche-delivery-rate.md | 2 +- rs/qmux/README.md | 8 ++ rs/qmux/src/socket.rs | 178 +++++++++++++++++++++++++++++-- 7 files changed, 177 insertions(+), 49 deletions(-) delete mode 100644 quest/a1/qmux-rate-filter.md diff --git a/quest/a0/qmux-socket-teardown.md b/quest/a0/qmux-socket-teardown.md index 2bd9d81f..8758b8a7 100644 --- a/quest/a0/qmux-socket-teardown.md +++ b/quest/a0/qmux-socket-teardown.md @@ -13,7 +13,3 @@ Approved behavior: socket-derived metrics become unavailable after teardown; oth ## Closes - [#383](https://github.com/moq-dev/web-transport/issues/383) - the implementation completes this report - -## Related - -- [QMux send-rate filter](/quest/a1/qmux-rate-filter.md) - adds state to the same `TcpStats` diff --git a/quest/a1/README.md b/quest/a1/README.md index 951db889..bf179954 100644 --- a/quest/a1/README.md +++ b/quest/a1/README.md @@ -10,7 +10,6 @@ The Required list is ordered by priority. Independent children may proceed concu ## Required -- [QMux send-rate filter](/quest/a1/qmux-rate-filter.md) - app-limited samples no longer lower the estimate, on main and 0.5 - [QMux send-rate filter on 0.5](/quest/a1/qmux-rate-filter-0.5.md) - backport for published moq-relay - [Dual-stack bind](/quest/a1/dual-stack-bind.md) - native clients bind by the server's address family - [Router crypto features](/quest/a1/router-crypto-features.md) - interim aws-lc-rs/ring features on `web-transport` diff --git a/quest/a1/qmux-rate-filter-0.5.md b/quest/a1/qmux-rate-filter-0.5.md index 0f94d8e9..25d44e3b 100644 --- a/quest/a1/qmux-rate-filter-0.5.md +++ b/quest/a1/qmux-rate-filter-0.5.md @@ -8,10 +8,6 @@ The `qmux-v0.5.x` line has the same app-limited send-rate filter as main, so the Cherry-pick or port the main-branch change onto `qmux-v0.5.x` in a PR against that branch, as [#412](https://github.com/moq-dev/web-transport/pull/412)/[#413](https://github.com/moq-dev/web-transport/pull/413) do, with the same tests. Don't publish the release yourself. -## Required - -- [QMux send-rate filter](/quest/a1/qmux-rate-filter.md) - the main-branch change this backports - ## Closes - [#460](https://github.com/moq-dev/web-transport/issues/460) - the reporter runs the 0.5 line through moq-relay diff --git a/quest/a1/qmux-rate-filter.md b/quest/a1/qmux-rate-filter.md deleted file mode 100644 index b16f041a..00000000 --- a/quest/a1/qmux-rate-filter.md +++ /dev/null @@ -1,29 +0,0 @@ -# [S] Keep app-limited samples from lowering QMux's send-rate estimate - -## Goal - -On Linux, `TcpStats::estimated_send_rate` reports available bandwidth rather than the sender's own rate. An app-limited `delivery_rate` sample can raise the estimate but never lower it, so a live publisher's PROBE estimate stops alternating between its bitrate and path capacity over WebSocket/TCP. The fix ships on main and on the `qmux-v0.5.x` branch that published moq-relay depends on. - -## Plan - -Decided with the maintainer on 2026-11-06 (planning interview): - -- Fix it in qmux, not in the player. The trait documents "estimated available send bandwidth", and a raw app-limited delivery rate breaks that promise. -- Port moq's in-tree `RateFilter` from [moq-dev/moq#6925](https://github.com/moq-dev/moq/pull/6925) so the two qmux copies don't drift. It is a BBR-style windowed maximum over 10 s. A sample that isn't app-limited replaces older maxima once they leave the window. An app-limited sample counts only when it is at least the current maximum. A rejected sample changes nothing, expiry included. A zero rate is no sample. The flag is the first bitfield in the `tcpi_app_limited` byte (`tcpi_delivery_rate_app_limited:1`): bit 0 on little-endian targets, bit 7 on big-endian ones. Derive the mask from `target_endian` and pin it with a layout test. moq's copy masks bit 0 everywhere; report that as a follow-up there. -- `TcpStats` gains a small lock around the filter. macOS still reports no rate. -- Test the filter with controlled time: app-limited samples never lower the estimate, a real sample replaces expired maxima, and rejected samples retire nothing. -- This quest lands on main. The `qmux-v0.5.x` backport is [its own quest](/quest/a1/qmux-rate-filter-0.5.md), which closes the issue, because published moq-relay (0.17.14) depends on `qmux ^0.5.3`. -- Other backends are audited separately in [the quiche audit](/quest/a2/quiche-delivery-rate.md). Quinn and Noq report the pacing rate or cwnd/rtt, which don't have this flaw. - -Decision prompts (✅ chosen): - -- Goal: fix in qmux / ✅ also audit other backends / won't fix here. -- App-limited handling: hold raise-only (first pick) / windowed max / None when app-limited / `tcpi_pacing_rate`. Replaced by: ✅ port moq's RateFilter / keep hold. -- Quiche audit: ✅ separate quest / same quest. -- 0.5 line: ✅ main + 0.5 backport / main only. -- Placement: ✅ top of a1. - -## Related - -- [#460](https://github.com/moq-dev/web-transport/issues/460) - closed by the 0.5 backport -- [QMux socket teardown](/quest/a0/qmux-socket-teardown.md) - edits the same `TcpStats` ownership diff --git a/quest/a2/quiche-delivery-rate.md b/quest/a2/quiche-delivery-rate.md index 86041506..14ced974 100644 --- a/quest/a2/quiche-delivery-rate.md +++ b/quest/a2/quiche-delivery-rate.md @@ -8,6 +8,6 @@ web-transport-quiche's `estimated_send_rate` reports available bandwidth under e `ez/connection.rs` reports quiche's `PathStats::delivery_rate * 8` as-is. In quiche 0.30 that value is BBR2's filtered bandwidth estimate under gcongestion, but the latest raw rate sample under legacy CUBIC/Reno. That is the flaw [#460](https://github.com/moq-dev/web-transport/issues/460) found in qmux. -Confirm which controllers web-transport-quiche configures by default and on request, and whether app-limited samples reach the reported value. If they do, prefer a filtered value quiche exposes publicly (such as `max_bandwidth` where it exists), or apply the same rule as [the qmux filter](/quest/a1/qmux-rate-filter.md) when quiche exposes the app-limited state. Otherwise document the limitation on the method. Use only quiche's public API, and don't fork its recovery code. +Confirm which controllers web-transport-quiche configures by default and on request, and whether app-limited samples reach the reported value. If they do, prefer a filtered value quiche exposes publicly (such as `max_bandwidth` where it exists), or apply the same rule as [the qmux filter](https://github.com/moq-dev/web-transport/pull/487) when quiche exposes the app-limited state. Otherwise document the limitation on the method. Use only quiche's public API, and don't fork its recovery code. Decided with the maintainer on 2026-11-06: a separate quest from the qmux fix, in a2. diff --git a/rs/qmux/README.md b/rs/qmux/README.md index 57baf91f..1f25e06d 100644 --- a/rs/qmux/README.md +++ b/rs/qmux/README.md @@ -68,6 +68,14 @@ grow a response queue by sending more pings; inbound stream processing continues while the writer is blocked. Pending responses are discarded during teardown, and a close frame ends the writer's output. +## Send-rate estimate + +On Linux, TCP and WebSocket sessions with `TcpStats` estimate available send +bandwidth from a 10-second maximum of kernel delivery-rate samples. An +application-limited sample can raise the estimate but cannot lower it, even after +the window expires. Only a usable sample retires old measurements; a zero rate +keeps the last estimate. macOS does not expose a delivery-rate estimate. + ## License Licensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or [MIT license](LICENSE-MIT) at your option. diff --git a/rs/qmux/src/socket.rs b/rs/qmux/src/socket.rs index 615b1448..9f022a4b 100644 --- a/rs/qmux/src/socket.rs +++ b/rs/qmux/src/socket.rs @@ -12,16 +12,16 @@ use std::time::Duration; /// Live statistics for the connection underneath a QMux session. /// -/// Implementations read through to the socket on each call rather than caching, so -/// a caller polling this sees the transport's current view. Every metric is -/// optional: `None` means this transport doesn't track it. +/// Implementations sample the socket on each call and may filter measurements to +/// estimate available capacity. Every metric is optional: `None` means this +/// transport has no estimate for it. pub trait SocketStats: Send + Sync + 'static { /// Smoothed round-trip time, if the transport tracks one. fn rtt(&self) -> Option { None } - /// Estimated delivery rate in **bits per second**, if the transport tracks one. + /// Estimated available send bandwidth in **bits per second**, if known. fn estimated_send_rate(&self) -> Option { None } @@ -30,6 +30,40 @@ pub trait SocketStats: Send + Sync + 'static { /// A shared handle to a transport's statistics. pub type SharedSocketStats = Arc; +/// Windowed maximum of delivery-rate samples, like BBR's bandwidth filter. +/// +/// App-limited samples measure the sender rather than the path, so they may only +/// raise the estimate. Only a usable sample can retire old maxima. +#[derive(Debug, Default)] +#[cfg(any(target_os = "linux", test))] +struct RateFilter { + /// Strictly decreasing rates from front to back; the front is the maximum. + samples: std::collections::VecDeque<(std::time::Instant, u64)>, +} + +#[cfg(any(target_os = "linux", test))] +impl RateFilter { + const WINDOW: Duration = Duration::from_secs(10); + + fn update(&mut self, now: std::time::Instant, rate: u64, app_limited: bool) -> Option { + let expired = |at: &std::time::Instant| now.saturating_duration_since(*at) > Self::WINDOW; + let usable = + rate > 0 && (!app_limited || self.samples.front().is_none_or(|(_, max)| rate >= *max)); + // A rejected sample changes nothing, not even expiry: it is no evidence + // that the path got slower. Zero is no sample at all. + if usable { + while self.samples.front().is_some_and(|(at, _)| expired(at)) { + self.samples.pop_front(); + } + while self.samples.back().is_some_and(|(_, r)| *r <= rate) { + self.samples.pop_back(); + } + self.samples.push_back((now, rate)); + } + self.samples.front().map(|(_, max)| *max) + } +} + #[cfg(unix)] pub use unix::TcpStats; @@ -52,14 +86,14 @@ mod unix { #[derive(Debug)] pub struct TcpStats { fd: OwnedFd, + #[cfg(target_os = "linux")] + rate: std::sync::Mutex, } impl TcpStats { /// Duplicate `socket`'s descriptor and read statistics from the copy. pub fn new(socket: &S) -> io::Result { - Ok(Self { - fd: socket.as_fd().try_clone_to_owned()?, - }) + Ok(Self::from_fd(socket.as_fd().try_clone_to_owned()?)) } /// Take ownership of an already-duplicated descriptor. @@ -67,7 +101,11 @@ mod unix { /// Use this when the socket itself has been moved somewhere unreachable (a /// type-erased HTTP upgrade, for instance) and only the descriptor was kept. pub fn from_fd(fd: OwnedFd) -> Self { - Self { fd } + Self { + fd, + #[cfg(target_os = "linux")] + rate: Default::default(), + } } fn borrow(&self) -> BorrowedFd<'_> { @@ -144,6 +182,13 @@ mod unix { const IPPROTO_TCP: libc::c_int = 6; const TCP_INFO: libc::c_int = 11; + // `tcpi_delivery_rate_app_limited:1` is the first bitfield in its byte. + pub const APP_LIMITED: u8 = if cfg!(target_endian = "little") { + 1 + } else { + 1 << 7 + }; + /// Read `tcp_info`, returning it alongside the number of bytes the kernel /// filled in. `None` if the socket isn't TCP. pub fn tcp_info(fd: BorrowedFd<'_>) -> Option<(TcpInfo, usize)> { @@ -255,13 +300,21 @@ mod unix { // rather than a figure callers would mistake for a measurement. #[cfg(target_os = "linux")] { + // Serialize sampling as well as updates so concurrent callers + // cannot insert older measurements after newer ones. + let mut filter = self + .rate + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner); let (info, len) = sys::tcp_info(self.borrow())?; let offset = std::mem::offset_of!(sys::TcpInfo, delivery_rate); - if !sys::has_field(len, offset, size_of::()) || info.delivery_rate == 0 { + if !sys::has_field(len, offset, size_of::()) { return None; } + let app_limited = info.app_limited & sys::APP_LIMITED != 0; // The kernel reports bytes per second; the trait wants bits. - Some(info.delivery_rate.saturating_mul(8)) + let rate = info.delivery_rate.saturating_mul(8); + filter.update(std::time::Instant::now(), rate, app_limited) } #[cfg(not(target_os = "linux"))] @@ -282,10 +335,36 @@ mod unix { /// would read a plausible-looking wrong number rather than fail. #[cfg(test)] mod tests { + #[cfg(target_os = "linux")] + #[test] + fn zero_kernel_rate_keeps_the_last_estimate() { + use super::*; + use std::net::{TcpListener, TcpStream}; + + let listener = TcpListener::bind("127.0.0.1:0").unwrap(); + let socket = TcpStream::connect(listener.local_addr().unwrap()).unwrap(); + let (_peer, _) = listener.accept().unwrap(); + let stats = TcpStats::new(&socket).unwrap(); + let (info, _) = sys::tcp_info(stats.borrow()).unwrap(); + assert_eq!(info.delivery_rate, 0, "no payload has been sent"); + assert_eq!(stats.estimated_send_rate(), None); + stats + .rate + .lock() + .unwrap() + .update(std::time::Instant::now(), 80_000_000, false); + assert_eq!(stats.estimated_send_rate(), Some(80_000_000)); + } + /// Offsets from `linux/tcp.h`. #[cfg(target_os = "linux")] #[test] fn linux_tcp_info_layout() { + assert_eq!(std::mem::offset_of!(super::sys::TcpInfo, app_limited), 7); + #[cfg(target_endian = "little")] + assert_eq!(super::sys::APP_LIMITED, 0x01); + #[cfg(target_endian = "big")] + assert_eq!(super::sys::APP_LIMITED, 0x80); assert_eq!(std::mem::offset_of!(super::sys::TcpInfo, rtt), 68); assert_eq!( std::mem::offset_of!(super::sys::TcpInfo, delivery_rate), @@ -301,3 +380,82 @@ mod unix { } } } + +#[cfg(test)] +mod rate_filter_tests { + use super::*; + use std::time::Instant; + + fn at(start: Instant, ms: u64) -> Instant { + start + Duration::from_millis(ms) + } + + #[test] + fn app_limited_samples_only_raise_the_estimate() { + let t = Instant::now(); + let mut f = RateFilter::default(); + assert_eq!(f.update(t, 1_000_000, true), Some(1_000_000)); + assert_eq!(f.update(at(t, 100), 80_000_000, true), Some(80_000_000)); + assert_eq!(f.update(at(t, 200), 1_000_000, true), Some(80_000_000)); + assert_eq!(f.update(at(t, 20_000), 1_000_000, true), Some(80_000_000)); + } + + #[test] + fn measured_samples_replace_maxima_only_after_the_window() { + let t = Instant::now(); + let mut f = RateFilter::default(); + assert_eq!(f.update(t, 80_000_000, false), Some(80_000_000)); + assert_eq!(f.update(at(t, 1_000), 5_000_000, false), Some(80_000_000)); + assert_eq!( + f.update(t + RateFilter::WINDOW, 4_000_000, false), + Some(80_000_000) + ); + assert_eq!(f.update(at(t, 10_001), 3_000_000, false), Some(5_000_000)); + } + + #[test] + fn rejected_samples_change_nothing_including_expiry() { + let t = Instant::now(); + let mut f = RateFilter::default(); + f.update(t, 80_000_000, false); + f.update(at(t, 1_000), 5_000_000, false); + assert_eq!(f.update(at(t, 20_000), 1_000_000, true), Some(80_000_000)); + assert_eq!(f.update(at(t, 30_000), 1_000_000, true), Some(80_000_000)); + assert_eq!(f.update(at(t, 31_000), 4_000_000, false), Some(4_000_000)); + } + + #[test] + fn window_keeps_the_largest_recent_measurement() { + let t = Instant::now(); + let mut f = RateFilter::default(); + f.update(t, 30_000_000, false); + f.update(at(t, 4_000), 20_000_000, false); + f.update(at(t, 8_000), 10_000_000, false); + assert_eq!(f.update(at(t, 10_500), 9_000_000, false), Some(20_000_000)); + assert_eq!(f.update(at(t, 14_500), 9_000_000, false), Some(10_000_000)); + assert_eq!(f.update(at(t, 18_500), 9_000_000, false), Some(9_000_000)); + } + + #[test] + fn equal_app_limited_sample_refreshes_the_maximum() { + let t = Instant::now(); + let mut f = RateFilter::default(); + f.update(t, 80_000_000, false); + assert_eq!(f.update(at(t, 9_000), 80_000_000, true), Some(80_000_000)); + assert_eq!(f.update(at(t, 11_000), 5_000_000, false), Some(80_000_000)); + assert_eq!(f.update(at(t, 19_001), 4_000_000, false), Some(5_000_000)); + } + + #[test] + fn zero_rate_is_not_a_sample() { + let t = Instant::now(); + let mut f = RateFilter::default(); + assert_eq!(f.update(t, 0, false), None); + assert_eq!(f.update(t, 0, true), None); + f.update(at(t, 100), 80_000_000, false); + f.update(at(t, 1_000), 5_000_000, false); + assert_eq!(f.update(at(t, 20_000), 0, false), Some(80_000_000)); + assert_eq!(f.update(at(t, 30_000), 0, true), Some(80_000_000)); + assert_eq!(f.update(at(t, 31_000), 4_000_000, false), Some(4_000_000)); + } +} From cfe3e5ff9c56616153b58f0c3aa54e46b2a27c74 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 7 Nov 2026 01:13:18 -0800 Subject: [PATCH 3/4] test(qmux): avoid handshake rate assumptions Read zero-sample TCP_INFO from a listener so the retention regression is independent of kernel SYN sampling. (Written by GPT-6.1 Sol with xhigh) --- rs/qmux/src/socket.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rs/qmux/src/socket.rs b/rs/qmux/src/socket.rs index 9f022a4b..efe4c2ce 100644 --- a/rs/qmux/src/socket.rs +++ b/rs/qmux/src/socket.rs @@ -339,14 +339,14 @@ mod unix { #[test] fn zero_kernel_rate_keeps_the_last_estimate() { use super::*; - use std::net::{TcpListener, TcpStream}; + use std::net::TcpListener; + // A listener has no ACK-derived samples, regardless of how a kernel + // accounts for SYNs on connected sockets. let listener = TcpListener::bind("127.0.0.1:0").unwrap(); - let socket = TcpStream::connect(listener.local_addr().unwrap()).unwrap(); - let (_peer, _) = listener.accept().unwrap(); - let stats = TcpStats::new(&socket).unwrap(); + let stats = TcpStats::new(&listener).unwrap(); let (info, _) = sys::tcp_info(stats.borrow()).unwrap(); - assert_eq!(info.delivery_rate, 0, "no payload has been sent"); + assert_eq!(info.delivery_rate, 0, "a listener has no rate samples"); assert_eq!(stats.estimated_send_rate(), None); stats .rate From 97bf03e046fe7eba71ccc9bd563e4682f5a69620 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sun, 8 Nov 2026 09:08:08 -0800 Subject: [PATCH 4/4] quest: drop the QMux send-rate filter quests QMux is moving to moq-dev/moq, which already has its own RateFilter. Co-Authored-By: Claude Opus 5.5 --- quest/a0/qmux-socket-teardown.md | 4 ---- quest/a1/README.md | 2 -- quest/a1/qmux-rate-filter-0.5.md | 17 ----------------- quest/a1/qmux-rate-filter.md | 29 ----------------------------- quest/a2/quiche-delivery-rate.md | 2 +- 5 files changed, 1 insertion(+), 53 deletions(-) delete mode 100644 quest/a1/qmux-rate-filter-0.5.md delete mode 100644 quest/a1/qmux-rate-filter.md diff --git a/quest/a0/qmux-socket-teardown.md b/quest/a0/qmux-socket-teardown.md index 2bd9d81f..8758b8a7 100644 --- a/quest/a0/qmux-socket-teardown.md +++ b/quest/a0/qmux-socket-teardown.md @@ -13,7 +13,3 @@ Approved behavior: socket-derived metrics become unavailable after teardown; oth ## Closes - [#383](https://github.com/moq-dev/web-transport/issues/383) - the implementation completes this report - -## Related - -- [QMux send-rate filter](/quest/a1/qmux-rate-filter.md) - adds state to the same `TcpStats` diff --git a/quest/a1/README.md b/quest/a1/README.md index 951db889..0f570d32 100644 --- a/quest/a1/README.md +++ b/quest/a1/README.md @@ -10,8 +10,6 @@ The Required list is ordered by priority. Independent children may proceed concu ## Required -- [QMux send-rate filter](/quest/a1/qmux-rate-filter.md) - app-limited samples no longer lower the estimate, on main and 0.5 -- [QMux send-rate filter on 0.5](/quest/a1/qmux-rate-filter-0.5.md) - backport for published moq-relay - [Dual-stack bind](/quest/a1/dual-stack-bind.md) - native clients bind by the server's address family - [Router crypto features](/quest/a1/router-crypto-features.md) - interim aws-lc-rs/ring features on `web-transport` - [Rust crates on rind](/quest/a1/rind/README.md) - no C crypto outside Quiche diff --git a/quest/a1/qmux-rate-filter-0.5.md b/quest/a1/qmux-rate-filter-0.5.md deleted file mode 100644 index 0f94d8e9..00000000 --- a/quest/a1/qmux-rate-filter-0.5.md +++ /dev/null @@ -1,17 +0,0 @@ -# [XS] Backport the QMux send-rate filter to 0.5 - -## Goal - -The `qmux-v0.5.x` line has the same app-limited send-rate filter as main, so the next 0.5.x patch fixes the moq-relay releases that depend on `qmux ^0.5.3`. - -## Plan - -Cherry-pick or port the main-branch change onto `qmux-v0.5.x` in a PR against that branch, as [#412](https://github.com/moq-dev/web-transport/pull/412)/[#413](https://github.com/moq-dev/web-transport/pull/413) do, with the same tests. Don't publish the release yourself. - -## Required - -- [QMux send-rate filter](/quest/a1/qmux-rate-filter.md) - the main-branch change this backports - -## Closes - -- [#460](https://github.com/moq-dev/web-transport/issues/460) - the reporter runs the 0.5 line through moq-relay diff --git a/quest/a1/qmux-rate-filter.md b/quest/a1/qmux-rate-filter.md deleted file mode 100644 index b16f041a..00000000 --- a/quest/a1/qmux-rate-filter.md +++ /dev/null @@ -1,29 +0,0 @@ -# [S] Keep app-limited samples from lowering QMux's send-rate estimate - -## Goal - -On Linux, `TcpStats::estimated_send_rate` reports available bandwidth rather than the sender's own rate. An app-limited `delivery_rate` sample can raise the estimate but never lower it, so a live publisher's PROBE estimate stops alternating between its bitrate and path capacity over WebSocket/TCP. The fix ships on main and on the `qmux-v0.5.x` branch that published moq-relay depends on. - -## Plan - -Decided with the maintainer on 2026-11-06 (planning interview): - -- Fix it in qmux, not in the player. The trait documents "estimated available send bandwidth", and a raw app-limited delivery rate breaks that promise. -- Port moq's in-tree `RateFilter` from [moq-dev/moq#6925](https://github.com/moq-dev/moq/pull/6925) so the two qmux copies don't drift. It is a BBR-style windowed maximum over 10 s. A sample that isn't app-limited replaces older maxima once they leave the window. An app-limited sample counts only when it is at least the current maximum. A rejected sample changes nothing, expiry included. A zero rate is no sample. The flag is the first bitfield in the `tcpi_app_limited` byte (`tcpi_delivery_rate_app_limited:1`): bit 0 on little-endian targets, bit 7 on big-endian ones. Derive the mask from `target_endian` and pin it with a layout test. moq's copy masks bit 0 everywhere; report that as a follow-up there. -- `TcpStats` gains a small lock around the filter. macOS still reports no rate. -- Test the filter with controlled time: app-limited samples never lower the estimate, a real sample replaces expired maxima, and rejected samples retire nothing. -- This quest lands on main. The `qmux-v0.5.x` backport is [its own quest](/quest/a1/qmux-rate-filter-0.5.md), which closes the issue, because published moq-relay (0.17.14) depends on `qmux ^0.5.3`. -- Other backends are audited separately in [the quiche audit](/quest/a2/quiche-delivery-rate.md). Quinn and Noq report the pacing rate or cwnd/rtt, which don't have this flaw. - -Decision prompts (✅ chosen): - -- Goal: fix in qmux / ✅ also audit other backends / won't fix here. -- App-limited handling: hold raise-only (first pick) / windowed max / None when app-limited / `tcpi_pacing_rate`. Replaced by: ✅ port moq's RateFilter / keep hold. -- Quiche audit: ✅ separate quest / same quest. -- 0.5 line: ✅ main + 0.5 backport / main only. -- Placement: ✅ top of a1. - -## Related - -- [#460](https://github.com/moq-dev/web-transport/issues/460) - closed by the 0.5 backport -- [QMux socket teardown](/quest/a0/qmux-socket-teardown.md) - edits the same `TcpStats` ownership diff --git a/quest/a2/quiche-delivery-rate.md b/quest/a2/quiche-delivery-rate.md index 86041506..922ba9d9 100644 --- a/quest/a2/quiche-delivery-rate.md +++ b/quest/a2/quiche-delivery-rate.md @@ -8,6 +8,6 @@ web-transport-quiche's `estimated_send_rate` reports available bandwidth under e `ez/connection.rs` reports quiche's `PathStats::delivery_rate * 8` as-is. In quiche 0.30 that value is BBR2's filtered bandwidth estimate under gcongestion, but the latest raw rate sample under legacy CUBIC/Reno. That is the flaw [#460](https://github.com/moq-dev/web-transport/issues/460) found in qmux. -Confirm which controllers web-transport-quiche configures by default and on request, and whether app-limited samples reach the reported value. If they do, prefer a filtered value quiche exposes publicly (such as `max_bandwidth` where it exists), or apply the same rule as [the qmux filter](/quest/a1/qmux-rate-filter.md) when quiche exposes the app-limited state. Otherwise document the limitation on the method. Use only quiche's public API, and don't fork its recovery code. +Confirm which controllers web-transport-quiche configures by default and on request, and whether app-limited samples reach the reported value. If they do, prefer a filtered value quiche exposes publicly (such as `max_bandwidth` where it exists), or apply the same rule as moq's `RateFilter` ([moq-dev/moq#6925](https://github.com/moq-dev/moq/pull/6925)) when quiche exposes the app-limited state. Otherwise document the limitation on the method. Use only quiche's public API, and don't fork its recovery code. Decided with the maintainer on 2026-11-06: a separate quest from the qmux fix, in a2.