Skip to content

feat(transport): close connection after N consecutive PTOs - #3662

Merged
mxinden merged 1 commit into
mozilla:mainfrom
mxinden-bot:max-pto-declare-broken-connection
Jul 21, 2026
Merged

mxinden merged 1 commit into
mozilla:mainfrom
mxinden-bot:max-pto-declare-broken-connection

Conversation

@mxinden

@mxinden mxinden commented Jun 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds an opt-in ConnectionParameters::max_pto(Some(count)). When set, the connection is closed locally with a new, distinct reason Error::TooManyPtos once count consecutive PTOs have fired without any acknowledgement, i.e. the path has black-holed.

This is a safeguard for when the path breaks: if packets stop getting through entirely, the connection is closed promptly and with a reason the application can act on, instead of waiting out max_idle_timeout and reporting a generic timeout.

Motivation: the facebook-not-loading incident

Recent incident (the same one behind #3573): with SCONE padding enabled, a client completed the QUIC handshake to Facebook, exchanged some application data, and then an on-path antivirus middlebox (BitDefender) silently dropped the altered post-handshake server frames. From neqo's point of view: the client had requests outstanding, its packets stopped being acked, and nothing came back.

Per RFC 9002 §6.2.1 the PTO backs off without bound, and per RFC 9000 §10.1 the idle timeout is the designated backstop (and is held >= 3*PTO precisely so probes can be lost before it fires). The consequence for this incident: the only thing that ends a post-handshake black hole today is the idle timeout, 30 s, and HTTP/3 has no HTTP/2 fallback after the handshake. The user sees a spinner, and a reload just pins a fresh request onto the same dead connection for another 30 s.

The sooner the connection is declared broken, the better on two fronts. First, fewer requests are sent into the abyss: the application stops piling new streams onto a dead connection. Second, Firefox can surface an actionable error page sooner, for example one suggesting the user disable their antivirus, instead of leaving them on a spinner for 30 s per attempt.

Worked example

With exponential backoff (pto_period = base_PTO * 2^count, default fast_pto factor = 1), the n-th consecutive PTO fires at base_PTO * (2^n - 1), so max_pto = 7 fires at 127 * base_PTO.

Facebook's edge is close; take RTT ~= 50 ms, so base_PTO = smoothed_rtt + 4*rttvar + max_ack_delay ~= 50 + ~25 + 25 = ~100 ms.

  • Dead today (idle timeout): 30 s
  • Dead with max_pto = 7: 127 * 100 ms ~= 12.7 s
  • ~17 s earlier, less than half the time.

How it scales (the virtue of a count over a fixed timer: it tracks RTT, so it fails fast on a quick path and waits longer on a genuinely slow one):

base_PTO (~ RTT) dead at 7 PTOs (127x) vs. 30 s idle earlier by
50 ms (~25 ms RTT) 6.4 s 30 s ~23.6 s
100 ms (~50 ms RTT) 12.7 s 30 s ~17.3 s
150 ms (~75 ms RTT) 19.0 s 30 s ~11 s
200 ms (~100 ms RTT) 25.4 s 30 s ~4.6 s

Beyond "earlier", the close carries a distinct reason (TooManyPtos, not IdleTimeout), so the application can tell a black hole apart from an ordinary idle close and react (error page, disable HTTP/3 for the origin and retry over HTTP/2, ...). That consumption is out of scope here; this PR only produces the earlier, distinct signal.

Prior art (this is not novel)

Closing or abandoning a path before the idle timeout, driven by unacked probes, is what the other major stacks already do, including the server in this incident:

7 is chosen to match mvfst's maxNumPTOs and QUICHE's effective 2+5 cumulative RTO delays. We might want to be more aggressive, i.e. choose a value like 5.

Copilot AI review requested due to automatic review settings June 1, 2026 08:42

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clean, well-motivated feature with good prior-art backing. The implementation is minimal and correctly mirrors the IdleTimeout path (direct transition to State::Closed, no CONNECTION_CLOSE sent into the black hole). The new pto_count() accessor cleanly delegates to the existing PtoState without duplicating state.

Two points worth discussing:

  1. Handshake-phase PTOs: the check currently fires regardless of connection state. Initial/Handshake-space PTOs also increment PtoState::count, so a lossy handshake (large server certificate, middlebox interference during handshake) could trigger TooManyPtos before the connection is established. The motivating scenario is post-handshake; gating on self.state.connected() would scope the feature to match.

  2. max_pto(Some(0)): since PtoState::new starts count at 1, a zero threshold would close the connection on the very first PTO, which is likely never desirable. A guard (debug assert or NonZeroUsize) would prevent accidental misconfiguration.

The test is solid — it verifies both the error variant and the "earlier than idle timeout" invariant. A follow-up test showing that an intermediate ACK resets the counter would further strengthen confidence in the consecutive-only semantics.

Comment thread neqo-transport/src/connection/mod.rs Resolved
Comment thread neqo-transport/src/connection/params.rs Resolved
Comment thread neqo-transport/src/recovery/mod.rs Resolved
@codecov

codecov Bot commented Jun 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.80%. Comparing base (67ee03f) to head (3d5d279).
⚠️ Report is 124 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3662      +/-   ##
==========================================
+ Coverage   95.19%   96.80%   +1.60%     
==========================================
  Files         111      120       +9     
  Lines       38145    40882    +2737     
  Branches    38145    40882    +2737     
==========================================
+ Hits        36314    39575    +3261     
- Misses       1142     1280     +138     
+ Partials      689       27     -662     
Flag Coverage Δ
freebsd 94.15% <100.00%> (-0.20%) ⬇️
linux 96.96% <100.00%> (+1.75%) ⬆️
macos 95.09% <100.00%> (-0.04%) ⬇️
windows 95.16% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
neqo-common 99.23% <ø> (+0.61%) ⬆️
neqo-http3 95.40% <ø> (+1.47%) ⬆️
neqo-qpack 97.26% <ø> (+1.63%) ⬆️
neqo-transport 97.76% <100.00%> (+1.87%) ⬆️
neqo-udp 95.37% <ø> (+10.67%) ⬆️
mtu 89.13% <ø> (+2.51%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@larseggert

Copy link
Copy Markdown
Collaborator

What if there is just a temporary drop in connectivity? Killing connections because the link went down for 10s seems harsh?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces an opt-in transport safeguard to proactively close QUIC connections that appear to be on a black-holed path by limiting the number of consecutive, unacknowledged PTO firings, surfacing a distinct close reason to the application.

Changes:

  • Add ConnectionParameters::max_pto(Some(count)) to configure a maximum number of consecutive PTOs without acknowledgements.
  • Close the connection locally with a new Error::TooManyPtos once the threshold is reached.
  • Add coverage to validate that max_pto closes earlier than the idle timeout in a black-hole scenario.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
neqo-transport/src/recovery/mod.rs Exposes consecutive PTO count from loss recovery state.
neqo-transport/src/lib.rs Adds Error::TooManyPtos and validates its error-code mapping in unit tests.
neqo-transport/src/connection/tests/idle.rs Adds a black-hole regression test ensuring close happens before idle timeout and reports TooManyPtos.
neqo-transport/src/connection/params.rs Adds max_pto connection parameter with builder/getter and documentation.
neqo-transport/src/connection/mod.rs Enforces max_pto during timer processing by closing after too many consecutive PTOs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread neqo-transport/src/connection/params.rs Resolved
Comment thread neqo-transport/src/recovery/mod.rs Resolved
@codspeed

codspeed Bot commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will regress 1 benchmark

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 3 improved benchmarks
❌ 1 regressed benchmark
✅ 77 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Memory simulated/10-streams/each-1048576-bytes 11.4 MB 12.4 MB -7.86%
⚡ Simulation simulated/10-streams/each-1048576-bytes 246.9 ms 231 ms +6.85%
⚡ Simulation coalesce_acked_from_zero 1 ranges 1.4 µs 1.4 µs +4.2%
⚡ Simulation coalesce_acked_from_zero 3 ranges 1.9 µs 1.8 µs +3.24%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing mxinden-bot:max-pto-declare-broken-connection (3d5d279) with main (9ec0cc6)

Open in CodSpeed

@mxinden

mxinden commented Jun 1, 2026 •

Copy link
Copy Markdown
Member Author

What if there is just a temporary drop in connectivity? Killing connections because the link went down for 10s seems harsh?

We would kill the connection and establish a new one. I would argue after a 10s connectivity loss, the <1s connection re-establishment time (potentially using 0-RTT) is negligible in terms of user experience.

@larseggert

Copy link
Copy Markdown
Collaborator

I'm all for automatically/transparently retrying sooner, but an earlier comments talks about "surface an actionable error page sooner", which is not that.

@mxinden

mxinden commented Jun 1, 2026 •

Copy link
Copy Markdown
Member Author

I'm all for automatically/transparently retrying sooner, but an earlier comments talks about "surface an actionable error page sooner", which is not that.

@larseggert I am not sure I am following. Can you rephrase the above?

In the facebook incident case, requests were sent on a dead connection, but only failed after 30s, i.e. the connection idle timeout. The faster we kill the dead connection, the faster Firefox learns that the request fails, the faster Firefox can show a network error page, e.g. with a hint to disable ones anti virus.

@larseggert

larseggert commented Jun 1, 2026 •

Copy link
Copy Markdown
Collaborator

From the first comment, it sounded like what this does is show an error page sooner, which I think is of questionable benefit. Your later comment then says this would let us retry sooner, which is obviously vastly better. I was reacting on the discrepancy.

@martinthomson

Copy link
Copy Markdown
Member

I'm supportive of this feature, though I think that we should move closer to the Chrome approach, where we enable the fast PTO as well. The fast PTO isn't quite a a TLP, but it does accelerate loss detection far more than a PTO. 7 PTOs with a PTO speedup brings the times down even further.

Note that we should ensure that this feature is not engaged until we have an RTT estimate. I need to check how you implemented this, but the super-long RTT cases will fail to connect if we let this act without a solid estimate.

Comment thread neqo-transport/src/connection/mod.rs Resolved
Comment thread neqo-transport/src/connection/params.rs Resolved
Comment thread neqo-transport/src/recovery/mod.rs Resolved
Comment thread neqo-transport/src/lib.rs Resolved
@larseggert

Copy link
Copy Markdown
Collaborator

FWIW, we have been doing fast PTO for the DoH connections in Gecko for a while now, and I don't think we're seeing issues. Am OK with doing it for all.

@larseggert

Copy link
Copy Markdown
Collaborator

FWIW, we have been doing fast PTO for the DoH connections in Gecko for a while now, and I don't think we're seeing issues. Am OK with doing it for all.

https://bugzilla.mozilla.org/show_bug.cgi?id=2047616

@mxinden mxinden mentioned this pull request Jun 19, 2026
@mxinden mxinden changed the title [discuss] feat(transport): close connection after N consecutive PTOs feat(transport): close connection after N consecutive PTOs Jul 17, 2026
@mxinden-bot
mxinden-bot force-pushed the max-pto-declare-broken-connection branch 5 times, most recently from 14e8d80 to 4f4602a Compare July 17, 2026 15:57
Add `ConnectionParameters::max_pto`, closing the connection with a distinct
`Error::TooManyPtos` once N consecutive PTOs fire without acknowledgement,
i.e. the path has black-holed. A safeguard for a broken path that gives up
sooner than, and with a more actionable reason than, the idle timeout.
Disabled by default (`None`).

Only engaged once connected, so a black-holed handshake is left to happy
eyeballs; this also guarantees an RTT estimate underpins the PTO backoff.
`max_pto` takes a `NonZeroUsize` so a zero threshold is unrepresentable, and
`TooManyPtos` reuses the NO_VIABLE_PATH (0x10) transport error code.

Prior art for giving up on a path before the idle timeout:
- mvfst maxNumPTOs=7: https://github.com/facebook/mvfst/blob/main/quic/QuicConstants.h
- QUICHE default 5-RTO blackhole detection (-> QUIC_TOO_MANY_RTOS): https://github.com/google/quiche/blob/main/quiche/quic/core/quic_sent_packet_manager.cc
- msquic DisconnectTimeoutMs=16s: https://github.com/microsoft/msquic/blob/main/docs/Settings.md
@mxinden-bot
mxinden-bot force-pushed the max-pto-declare-broken-connection branch from 4f4602a to 3d5d279 Compare July 17, 2026 16:12
@mxinden
mxinden requested a review from martinthomson July 17, 2026 16:26
@mxinden

mxinden commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

Thank you for the input.

I would like to move forward here, i.e. merge independent of Fast PTO. In my eyes this PR is an improvement in itself, only getting better with Fast PTO. The latter I would like to further discuss in #1236 (comment).

@martinthomson @larseggert any objections?

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark results

No significant performance differences relative to 9ec0cc6.

All results
streams/walltime/1-streams/each-1000-bytes: Change within noise threshold.
       time:   [549.39 µs 551.44 µs 553.80 µs]
       thrpt:  [1.7221 MiB/s 1.7294 MiB/s 1.7359 MiB/s]
change:
       time:   [+0.3652% +0.9652% +1.5887] (p = 0.00 < 0.05)
       thrpt:  [-1.5639% -0.9559% -0.3639]
       Change within noise threshold.
Found 13 outliers among 100 measurements (13.00%)
1 (1.00%) high mild
12 (12.00%) high severe
streams/walltime/1000-streams/each-1-bytes: Change within noise threshold.
       time:   [11.130 ms 11.146 ms 11.161 ms]
       thrpt:  [87.497 KiB/s 87.618 KiB/s 87.738 KiB/s]
change:
       time:   [+0.9674% +1.1806% +1.3926] (p = 0.00 < 0.05)
       thrpt:  [-1.3735% -1.1668% -0.9582]
       Change within noise threshold.
streams/walltime/1000-streams/each-1000-bytes: Change within noise threshold.
       time:   [31.634 ms 31.677 ms 31.720 ms]
       thrpt:  [30.065 MiB/s 30.106 MiB/s 30.147 MiB/s]
change:
       time:   [-1.7182% -1.5359% -1.3536] (p = 0.00 < 0.05)
       thrpt:  [+1.3721% +1.5598% +1.7483]
       Change within noise threshold.
streams-flow-controlled/walltime/1-streams/each-4194304-bytes: Change within noise threshold.
       time:   [26.631 ms 26.679 ms 26.728 ms]
       thrpt:  [149.65 MiB/s 149.93 MiB/s 150.20 MiB/s]
change:
       time:   [-1.7823% -1.5486% -1.3112] (p = 0.00 < 0.05)
       thrpt:  [+1.3286% +1.5729% +1.8147]
       Change within noise threshold.
streams-flow-controlled/walltime/10-streams/each-1048576-bytes: Change within noise threshold.
       time:   [69.996 ms 70.422 ms 70.857 ms]
       thrpt:  [141.13 MiB/s 142.00 MiB/s 142.86 MiB/s]
change:
       time:   [-3.4546% -2.5792% -1.7094] (p = 0.00 < 0.05)
       thrpt:  [+1.7391% +2.6475% +3.5783]
       Change within noise threshold.
transfer/walltime/pacing-false/varying-seeds: No change in performance detected.
       time:   [18.433 ms 18.448 ms 18.462 ms]
       thrpt:  [216.66 MiB/s 216.83 MiB/s 217.00 MiB/s]
change:
       time:   [-0.1213% -0.0297% +0.0638] (p = 0.54 > 0.05)
       thrpt:  [-0.0637% +0.0297% +0.1214]
       No change in performance detected.
transfer/walltime/pacing-true/varying-seeds: Change within noise threshold.
       time:   [18.785 ms 18.797 ms 18.809 ms]
       thrpt:  [212.67 MiB/s 212.80 MiB/s 212.94 MiB/s]
change:
       time:   [+1.4291% +1.5154% +1.6036] (p = 0.00 < 0.05)
       thrpt:  [-1.5783% -1.4928% -1.4089]
       Change within noise threshold.
transfer/walltime/pacing-false/same-seed: Change within noise threshold.
       time:   [18.444 ms 18.455 ms 18.466 ms]
       thrpt:  [216.62 MiB/s 216.74 MiB/s 216.87 MiB/s]
change:
       time:   [+0.2122% +0.2986% +0.3819] (p = 0.00 < 0.05)
       thrpt:  [-0.3805% -0.2977% -0.2118]
       Change within noise threshold.
transfer/walltime/pacing-true/same-seed: Change within noise threshold.
       time:   [18.869 ms 18.880 ms 18.892 ms]
       thrpt:  [211.73 MiB/s 211.86 MiB/s 211.99 MiB/s]
change:
       time:   [+0.1136% +0.1939% +0.2744] (p = 0.00 < 0.05)
       thrpt:  [-0.2737% -0.1936% -0.1134]
       Change within noise threshold.
Found 5 outliers among 100 measurements (5.00%)
3 (3.00%) low mild
2 (2.00%) high mild

Download data for profiler.firefox.com or download performance comparison data.

@github-actions

Copy link
Copy Markdown
Contributor

Failed Interop Tests

QUIC Interop Runner, client vs. server, differences relative to main at 9ec0cc6.

neqo-pr as clientneqo-pr as server
neqo-pr vs. go-x-net: BP BA
neqo-pr vs. haproxy: M BP BA
neqo-pr vs. kwik: BP BA
neqo-pr vs. linuxquic: 🚀L1 ⚠️C1 BP
neqo-pr vs. lsquic: baseline result missing
neqo-pr vs. msquic: A L1 C1
neqo-pr vs. mvfst: A 🚀BA
neqo-pr vs. neqo: A
neqo-pr vs. nginx: BP BA
neqo-pr vs. ngtcp2: CM
neqo-pr vs. picoquic: A
neqo-pr vs. quic-go: A
neqo-pr vs. quiche: BP BA
neqo-pr vs. s2n-quic: ⚠️BA CM
neqo-pr vs. tquic: S BP BA
neqo-pr vs. xquic: A L1 🚀C1
aioquic vs. neqo-pr: 🚀C1 CM
go-x-net vs. neqo-pr: CM
kwik vs. neqo-pr: BP BA CM
msquic vs. neqo-pr: 🚀L1 CM
mvfst vs. neqo-pr: Z L1 C1 CM
neqo vs. neqo-pr: A
openssl vs. neqo-pr: LR M A CM
quic-go vs. neqo-pr: CM
quiche vs. neqo-pr: CM
quinn vs. neqo-pr: 🚀L1 V2 CM
s2n-quic vs. neqo-pr: CM
tquic vs. neqo-pr: CM
xquic vs. neqo-pr: M CM
All results

Succeeded Interop Tests

QUIC Interop Runner, client vs. server

neqo-pr as client

neqo-pr as server

Unsupported Interop Tests

QUIC Interop Runner, client vs. server

neqo-pr as client

neqo-pr as server

@github-actions

Copy link
Copy Markdown
Contributor

Client/server transfer results

Performance differences relative to 9ec0cc6.

Transfer of 33554432 bytes over loopback, min. 100 runs. All unit-less numbers are in milliseconds.

Client vs. server Mean±σ Min–Max Median±MAD MiB/s±σ ΔMedian
neqo-neqo-cubic 79.5 ± 2.7 73.2 – 93.3 79.3 ± 2.1 402.7 ± 13.9 💔 +1.2 (+1.6%)
neqo-neqo-cubic-nopacing 80.2 ± 3.7 74.9 – 92.3 78.9 ± 2.3 398.8 ± 18.5 💚 -0.8 (-1.0%)

Table above only shows statistically significant changes. See all results below.

All results

Transfer of 33554432 bytes over loopback, min. 100 runs. All unit-less numbers are in milliseconds.

Client vs. server Mean±σ Min–Max Median±MAD MiB/s±σ ΔMedian
google-google 466.0 ± 2.8 458.2 – 478.3 465.5 ± 1.9 68.7 ± 0.4
google-neqo-cubic 273.0 ± 2.0 266.5 – 280.6 272.7 ± 1.4 117.2 ± 0.9 -1.2 (-0.4%)
neqo-google-cubic 769.3 ± 2.7 762.5 – 780.8 769.0 ± 2.0 41.6 ± 0.1 +0.9 (+0.1%)
neqo-neqo-cubic 79.5 ± 2.7 73.2 – 93.3 79.3 ± 2.1 402.7 ± 13.9 💔 +1.2 (+1.6%)
neqo-neqo-cubic-nopacing 80.2 ± 3.7 74.9 – 92.3 78.9 ± 2.3 398.8 ± 18.5 💚 -0.8 (-1.0%)
neqo-neqo-newreno 78.8 ± 2.3 72.7 – 86.1 78.3 ± 1.9 406.1 ± 11.9 +0.1 (+0.1%)
neqo-neqo-newreno-nopacing 80.5 ± 4.1 73.4 – 103.3 79.8 ± 2.8 397.7 ± 20.3 -0.8 (-1.0%)
neqo-quiche-cubic 195.2 ± 2.0 189.9 – 201.3 195.2 ± 1.5 163.9 ± 1.7 +0.1 (+0.0%)
neqo-s2n-cubic 214.5 ± 1.8 210.9 – 220.7 214.5 ± 1.5 149.2 ± 1.3 -0.2 (-0.1%)
quiche-neqo-cubic 137.5 ± 1.8 131.6 – 143.1 137.2 ± 1.0 232.8 ± 3.1 +0.3 (+0.2%)
quiche-quiche 134.4 ± 2.8 127.3 – 141.5 134.4 ± 3.1 238.0 ± 5.0
s2n-neqo-cubic 219.4 ± 2.3 214.8 – 227.9 219.0 ± 1.9 145.8 ± 1.5 -0.8 (-0.4%)
s2n-s2n ⚠️ 292.4 ± 25.0 279.6 – 386.9 285.4 ± 3.3 109.4 ± 9.3

Download data for profiler.firefox.com or download performance comparison data.

@mxinden

mxinden commented Jul 21, 2026 •

Copy link
Copy Markdown
Member Author

Merging here. Discussed with Martin at IETF. Off by default anyways. Happy to follow-up on any additional review comments after merge.

@mxinden
mxinden added this pull request to the merge queue Jul 21, 2026
Merged via the queue into mozilla:main with commit 03a083b Jul 21, 2026
195 of 198 checks passed
martinthomson pushed a commit to martinthomson/neqo that referenced this pull request Jul 29, 2026
…Os (mozilla#3662)

Add `ConnectionParameters::max_pto`, closing the connection with a distinct
`Error::TooManyPtos` once N consecutive PTOs fire without acknowledgement,
i.e. the path has black-holed. A safeguard for a broken path that gives up
sooner than, and with a more actionable reason than, the idle timeout.
Disabled by default (`None`).

Only engaged once connected, so a black-holed handshake is left to happy
eyeballs; this also guarantees an RTT estimate underpins the PTO backoff.
`max_pto` takes a `NonZeroUsize` so a zero threshold is unrepresentable, and
`TooManyPtos` reuses the NO_VIABLE_PATH (0x10) transport error code.

Prior art for giving up on a path before the idle timeout:
- mvfst maxNumPTOs=7: https://github.com/facebook/mvfst/blob/main/quic/QuicConstants.h
- QUICHE default 5-RTO blackhole detection (-> QUIC_TOO_MANY_RTOS): https://github.com/google/quiche/blob/main/quiche/quic/core/quic_sent_packet_manager.cc
- msquic DisconnectTimeoutMs=16s: https://github.com/microsoft/msquic/blob/main/docs/Settings.md
mxinden-bot pushed a commit to mxinden-bot/neqo that referenced this pull request Aug 2, 2026
Set the `ConnectionParameters` default for `max_pto` to 7, turning on the
black-hole detector added in mozilla#3662
(mozilla#3662) for all consumers instead of
leaving it opt-in.

A connection that sees 7 consecutive unacknowledged PTOs is almost certainly
black-holed. Closing it then (`Error::TooManyPtos`, sent on the wire as
`NO_VIABLE_PATH`) lets the application recover on a fresh path or another
protocol rather than hanging until the idle timeout. At a 20ms RTT the 7th
PTO fires around 2.5 to 5.7s, well inside the 30s idle timeout.

I plan to enable this in Firefox soon, so it is worth running neqo's own unit
tests with the detector on by default already.
mxinden-bot pushed a commit to mxinden-bot/neqo that referenced this pull request Aug 2, 2026
Set the `ConnectionParameters` default for `max_pto` to 7, turning on the
black-hole detector added in mozilla#3662
(mozilla#3662) for all consumers instead of
leaving it opt-in.

A connection that sees 7 consecutive unacknowledged PTOs is almost certainly
black-holed. Closing it then (`Error::TooManyPtos`, sent on the wire as
`NO_VIABLE_PATH`) lets the application recover on a fresh path or another
protocol rather than hanging until the idle timeout. At a 20ms RTT the 7th
PTO fires around 2.5 to 5.7s, well inside the 30s idle timeout.

I plan to enable this in Firefox soon, so it is worth running neqo's own unit
tests with the detector on by default already.
mxinden-bot pushed a commit to mxinden-bot/neqo that referenced this pull request Aug 2, 2026
Set the `ConnectionParameters` default for `max_pto` to 7, turning on the
black-hole detector added in mozilla#3662
(mozilla#3662) by default instead of leaving it
opt-in.

A connection that sees 7 consecutive unacknowledged PTOs is almost certainly
black-holed. Closing it then (`Error::TooManyPtos`, sent on the wire as
`NO_VIABLE_PATH`) lets the application recover on a fresh path or another
protocol rather than hanging until the idle timeout. At a 20ms RTT the 7th
PTO fires around 2.5 to 5.7s, well inside the 30s idle timeout.

Firefox is the only consumer today and I plan to enable this on its side soon,
so it is worth running neqo's own unit tests with the detector on by default
already.
mxinden-bot pushed a commit to mxinden-bot/neqo that referenced this pull request Aug 2, 2026
Set the `ConnectionParameters` default for `max_pto` to 7, turning on the
black-hole detector added in mozilla#3662
(mozilla#3662) by default instead of leaving it
opt-in.

A connection that sees 7 consecutive unacknowledged PTOs is almost certainly
black-holed. Closing it then (`Error::TooManyPtos`, sent on the wire as
`NO_VIABLE_PATH`) lets the application recover on a fresh path or another
protocol rather than hanging until the idle timeout. At a 20ms RTT the 7th
PTO fires around 2.5 to 5.7s, well inside the 30s idle timeout.

Firefox is the only consumer today and I plan to enable this on its side soon,
so it is worth running neqo's own unit tests with the detector on by default
already.

`fetch_noresponse_will_idletimeout` asserts an idle-timeout close that the new
default now preempts, so it opts out with `max_pto(None)` to keep exercising
that path.
mxinden-bot pushed a commit to mxinden-bot/neqo that referenced this pull request Aug 2, 2026
Set the `ConnectionParameters` default for `max_pto` to 7, turning on the
black-hole detector added in mozilla#3662
(mozilla#3662) by default instead of leaving it
opt-in.

A connection that sees 7 consecutive unacknowledged PTOs is almost certainly
black-holed. Closing it then (`Error::TooManyPtos`, sent on the wire as
`NO_VIABLE_PATH`) lets the application recover on a fresh path or another
protocol rather than hanging until the idle timeout. At a 20ms RTT the 7th
PTO fires around 2.5 to 5.7s, well inside the 30s idle timeout.

Firefox is the only consumer today and I plan to enable this on its side soon,
so it is worth running neqo's own unit tests with the detector on by default
already.

Replace `fetch_noresponse_will_idletimeout`, whose silent-server scenario now
black-holes, with `fetch_noresponse_healthy_path_stays_open`: the server keeps
acknowledging the client's keepalives but never answers the request, so the
path stays healthy and the connection must remain open. This checks max_pto
does not fire while packets are still getting through.
mxinden-bot pushed a commit to mxinden-bot/neqo that referenced this pull request Aug 3, 2026
Set the `ConnectionParameters` default for `max_pto` to 7, turning on the
black-hole detector added in mozilla#3662
(mozilla#3662) by default instead of leaving it
opt-in.

A connection that sees 7 consecutive unacknowledged PTOs is almost certainly
black-holed. Closing it then (`Error::TooManyPtos`, sent on the wire as
`NO_VIABLE_PATH`) lets the application recover on a fresh path or another
protocol rather than hanging until the idle timeout. At a 20ms RTT the 7th
PTO fires around 2.5 to 5.7s, well inside the 30s idle timeout.

Firefox is the only consumer today and I plan to enable this on its side soon,
so it is worth running neqo's own unit tests with the detector on by default
already.

Replace `fetch_noresponse_will_idletimeout`, whose silent-server scenario now
black-holes, with `fetch_noresponse_healthy_path_stays_open`: the server keeps
acknowledging the client's keepalives but never answers the request, so the
path stays healthy and the connection must remain open. This checks max_pto
does not fire while packets are still getting through.
mxinden-bot pushed a commit to mxinden-bot/neqo that referenced this pull request Aug 3, 2026
Set the `ConnectionParameters` default for `max_pto` to 7, turning on the
black-hole detector added in mozilla#3662
(mozilla#3662) by default instead of leaving it
opt-in.

A connection that sees 7 consecutive unacknowledged PTOs is almost certainly
black-holed. Closing it then (`Error::TooManyPtos`, sent on the wire as
`NO_VIABLE_PATH`) lets the application recover on a fresh path or another
protocol rather than hanging until the idle timeout. At a 20ms RTT the 7th
PTO fires around 2.5 to 5.7s, well inside the 30s idle timeout.

Firefox is the only consumer today and I plan to enable this on its side soon,
so it is worth running neqo's own unit tests with the detector on by default
already.

Replace `fetch_noresponse_will_idletimeout`, whose silent-server scenario now
black-holes, with `fetch_noresponse_healthy_path_stays_open`: the server keeps
acknowledging the client's keepalives but never answers the request, so the
path stays healthy and the connection must remain open. This checks max_pto
does not fire while packets are still getting through.
mxinden-bot pushed a commit to mxinden-bot/neqo that referenced this pull request Aug 3, 2026
Set the `ConnectionParameters` default for `max_pto` to 7, turning on the
black-hole detector added in mozilla#3662
(mozilla#3662) by default instead of leaving it
opt-in.

A connection that sees 7 consecutive unacknowledged PTOs is almost certainly
black-holed. Closing it then (`Error::TooManyPtos`, sent on the wire as
`NO_VIABLE_PATH`) lets the application recover on a fresh path or another
protocol rather than hanging until the idle timeout. At a 20ms RTT the 7th
PTO fires around 2.5 to 5.7s, well inside the 30s idle timeout.

Firefox is the only consumer today and I plan to enable this on its side soon,
so it is worth running neqo's own unit tests with the detector on by default
already.

Replace `fetch_noresponse_will_idletimeout`, whose silent-server scenario now
black-holes, with `fetch_noresponse_healthy_path_stays_open`: the server keeps
acknowledging the client's keepalives but never answers the request, so the
path stays healthy and the connection must remain open. This checks max_pto
does not fire while packets are still getting through.
larseggert added a commit to larseggert/neqo that referenced this pull request Aug 11, 2026
* Add some more tests for the HTTP/3 integration

* Reliable reset handling for HTTP/3

This follow-up to the RESET_STREAM_AT PR (mozilla#3754) makes changes to the
event handling in the HTTP/3 stack to make reliable delivery work
better.

This is entirely unnecessary, but I think that the change is worthwhile
doing on balance.  I wanted to improve test coverage and found that the
HTTP/3 event handling wasn't quite able to handle reliable resets
properly.  Making it proper took very little extra work (for the LLM),
so I think this is worth it.

The fixes here aren't likely to make a material difference in the real
world -- HTTP/3 requests that receive any type of reset probably need to
be dropped anyway -- but it makes our code more robust and better
tested.

* Confirm that we got a reset

* usize conversions (mozilla#3812)

* Start to move to a checked usize conversion

* Audit u64 to usize conversions

These turn out to be pretty reasonable to fix while I'm half paying
attention.

* Format better, because vscode

* Cleanup

* Deal with LLM feedback

* Don't overconstrain type bounds

* More LLM feedback

* Correct a comment

---------

Co-authored-by: Lars Eggert <lars@eggert.org>

* chore: prepare v0.30.1 (mozilla#3818)

* build(deps): bump CodSpeedHQ/action from 4.18.2 to 4.18.5 (mozilla#3822)

Bumps [CodSpeedHQ/action](https://github.com/codspeedhq/action) from 4.18.2 to 4.18.5.
- [Release notes](https://github.com/codspeedhq/action/releases)
- [Changelog](https://github.com/CodSpeedHQ/action/blob/main/CHANGELOG.md)
- [Commits](CodSpeedHQ/action@4e96933...f99becd)

---
updated-dependencies:
- dependency-name: CodSpeedHQ/action
  dependency-version: 4.18.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump vmactions/netbsd-vm (mozilla#3821)

Bumps the vm-actions group with 1 update in the /.github/actions/check-vm directory: [vmactions/netbsd-vm](https://github.com/vmactions/netbsd-vm).


Updates `vmactions/netbsd-vm` from 1.4.1 to 1.4.2
- [Release notes](https://github.com/vmactions/netbsd-vm/releases)
- [Commits](vmactions/netbsd-vm@1d97677...0c26a4c)

---
updated-dependencies:
- dependency-name: vmactions/netbsd-vm
  dependency-version: 1.4.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: vm-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump reactivecircus/android-emulator-runner (mozilla#3824)

Bumps [reactivecircus/android-emulator-runner](https://github.com/reactivecircus/android-emulator-runner) from 2.37.0 to 2.38.0.
- [Release notes](https://github.com/reactivecircus/android-emulator-runner/releases)
- [Changelog](https://github.com/ReactiveCircus/android-emulator-runner/blob/main/CHANGELOG.md)
- [Commits](ReactiveCircus/android-emulator-runner@e89f39f...a421e43)

---
updated-dependencies:
- dependency-name: reactivecircus/android-emulator-runner
  dependency-version: 2.38.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump actions/setup-java in /.github/actions/check-android (mozilla#3825)

Bumps [actions/setup-java](https://github.com/actions/setup-java) from 5.4.0 to 5.5.0.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](actions/setup-java@1bcf9fb...0f481fc)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-version: 5.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump github/codeql-action/upload-sarif (mozilla#3823)

Bumps [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) from 4.36.3 to 4.37.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@54f647b...99df26d)

---
updated-dependencies:
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 4.37.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat(transport): optionally close a connection after N consecutive PTOs (mozilla#3662)

Add `ConnectionParameters::max_pto`, closing the connection with a distinct
`Error::TooManyPtos` once N consecutive PTOs fire without acknowledgement,
i.e. the path has black-holed. A safeguard for a broken path that gives up
sooner than, and with a more actionable reason than, the idle timeout.
Disabled by default (`None`).

Only engaged once connected, so a black-holed handshake is left to happy
eyeballs; this also guarantees an RTT estimate underpins the PTO backoff.
`max_pto` takes a `NonZeroUsize` so a zero threshold is unrepresentable, and
`TooManyPtos` reuses the NO_VIABLE_PATH (0x10) transport error code.

Prior art for giving up on a path before the idle timeout:
- mvfst maxNumPTOs=7: https://github.com/facebook/mvfst/blob/main/quic/QuicConstants.h
- QUICHE default 5-RTO blackhole detection (-> QUIC_TOO_MANY_RTOS): https://github.com/google/quiche/blob/main/quiche/quic/core/quic_sent_packet_manager.cc
- msquic DisconnectTimeoutMs=16s: https://github.com/microsoft/msquic/blob/main/docs/Settings.md

* Make @omansfeld code owner for neqo-transport (mozilla#3826)

* Make @omansfeld code owner for neqo-transport

Signed-off-by: Lars Eggert <lars@eggert.org>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Lars Eggert <lars@eggert.org>

* Update .github/CODEOWNERS

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: Lars Eggert <lars@eggert.org>

---------

Signed-off-by: Lars Eggert <lars@eggert.org>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Remove stream error mapping on the recv path

* Add tests for some fairly gnarly corner cases

* fix comment

[ci skip]

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: Martin Thomson <mt@lowentropy.net>

* Fix clippy mess

* Take a comment suggestion

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: Martin Thomson <mt@lowentropy.net>

* A version of the suggestion

Signed-off-by: Martin Thomson <mt@lowentropy.net>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Lars Eggert <lars@eggert.org>
Signed-off-by: Martin Thomson <mt@lowentropy.net>
Co-authored-by: Lars Eggert <lars@eggert.org>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
mxinden-bot pushed a commit to mxinden-bot/neqo that referenced this pull request Aug 14, 2026
User-visible changes since v0.30.1:

- Update nss-rs to 0.14.4, now requiring NSS >= 3.126:
  mozilla#3874
- WebTransport getStats() support:
  mozilla#3835
- Reliable reset handling for HTTP/3:
  mozilla#3777
- Optionally close a connection after N consecutive PTOs:
  mozilla#3662
- Reject 0-RTT downgrade of h3 datagram and WebTransport settings:
  mozilla#3852
- Reject connection-specific header fields in HTTP/3 messages:
  mozilla#3806
- Reject qpack dynamic reference at or above required insert count:
  mozilla#3807
- Discard server Initial packets that carry a token:
  mozilla#3814
@mxinden mxinden mentioned this pull request Aug 14, 2026
mxinden-bot pushed a commit to mxinden-bot/neqo that referenced this pull request Aug 24, 2026
User-visible changes since v0.30.1:

- Update nss-rs to 0.14.4, now requiring NSS >= 3.126:
  mozilla#3874
- WebTransport getStats() support:
  mozilla#3835
- Reliable reset handling for HTTP/3:
  mozilla#3777
- Optionally close a connection after N consecutive PTOs:
  mozilla#3662
- Reject 0-RTT downgrade of h3 datagram and WebTransport settings:
  mozilla#3852
- Reject connection-specific header fields in HTTP/3 messages:
  mozilla#3806
- Reject qpack dynamic reference at or above required insert count:
  mozilla#3807
- Discard server Initial packets that carry a token:
  mozilla#3814
mxinden-bot pushed a commit to mxinden-bot/neqo that referenced this pull request Aug 25, 2026
Set the `ConnectionParameters` default for `max_pto` to 7, turning on the
black-hole detector added in mozilla#3662
(mozilla#3662) by default instead of leaving it
opt-in.

A connection that sees 7 consecutive unacknowledged PTOs is almost certainly
black-holed. Closing it then (`Error::TooManyPtos`, sent on the wire as
`NO_VIABLE_PATH`) lets the application recover on a fresh path or another
protocol rather than hanging until the idle timeout. At a 20ms RTT the 7th
PTO fires around 2.5 to 5.7s, well inside the 30s idle timeout.

Firefox is the only consumer today and I plan to enable this on its side soon,
so it is worth running neqo's own unit tests with the detector on by default
already.

Replace `fetch_noresponse_will_idletimeout`, whose silent-server scenario now
black-holes, with `fetch_noresponse_healthy_path_stays_open`: the server keeps
acknowledging the client's keepalives but never answers the request, so the
path stays healthy and the connection must remain open. This checks max_pto
does not fire while packets are still getting through.
@larseggert larseggert mentioned this pull request Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants