Repository navigation
test(e2e): decode every H2 status probe and derive the 810 budget - #1390
Merged
Merged
Conversation
Three e2e assertions that passed while proving less than their names claimed. Nineteen indexed-status byte probes scanned a HEADERS payload for `0x8D` (17) or `0x88` (2), in `h2_security_tests.rs` (16) and `h2_security_header_injection.rs` (3). `0x8D` is HPACK static index 13, `:status 404`; `:status 400` is index 12, `0x8C`. Sōzu answers an indexed `0x8d` 404 when the router finds no cluster, so a request it accepted and routed satisfied a term named `got_400` and reported itself as a rejection. A byte scan also fires on a length octet: RFC 7541 §5.1 writes a 268-byte header value as `7f 8d 01`. All nineteen go through one helper, `stream_status_matches`, built on the existing `decode_status`, which reads the first field of the block so neither a later field nor a length octet can answer for the status. The label was right and the byte was wrong at every site: each of those tests sends a malformed request and documents RFC 9113's "stream error or 400" contract, so every site decodes 400 and the comments are corrected rather than the assertions retargeted at 404. Measured before converting: every iteration of all fifteen `h2_security_tests.rs` sites reports `400: false` and produces no HEADERS frame at all. One site was not dead. The `asterisk-with-OPTIONS` case of `test_h2_path_syntax_enforced` — its deliberately accepted case — answers `HEADERS stream=7 status=404`, and its inner `protocol_error` probe read that as a 400. It stayed green only because the outer `rejected` probe was hardcoded to stream 1 while the case runs on stream 7; both are stream-scoped and decoded now. `h2_400_terms_decode_the_status_field_not_the_0x8d_byte` is the negative half. Closes #1374. Two assertions written `rejection || !got_200` passed when the worker returned nothing, because `got_200` is derived from frames that may never arrive: a silent reset, a timeout collecting zero frames or a worker that died between phases all read as success. `try_strict_sni_binding_toggle` (`listener_update_tests.rs`) asserts `got_rejection_or_421 && !got_200`, and narrows that term from `contains_goaway` — which matches the `GOAWAY(NO_ERROR)` graceful close riding behind the 421, so a 502 followed by the same close answered "a 421 or GOAWAY was observed" — to `rejected_with_goaway_or_rst`. `try_h2_invalid_status_rejected` (`h2_security_header_injection.rs`) asserts `got_frames && (protocol_rejection || got_502) && !got_200`. Closes #1381. `test_issue_810_timeout` asserted a zero-slack 100 ms shutdown budget 100 times over, one breach failing the run. 100 ms is not a margin there, it is exactly one tick of the two grids the shutdown path runs on: `Server::reset_loop_time_and_get_timeout` clamps the poll timeout to a 100 ms `shutdown_tick` while `shutting_down.is_some()` and `shut_down_sessions` runs once per loop iteration, so any iteration after the first costs a full `poll()` block; and the timer wheel's default `tick_ms` is 100 ms with `duration_to_tick` rounding to the NEAREST tick, displacing a timer-driven step by `(delay_ms + tick_ms / 2) mod tick_ms` ∈ [0, 99] ms. `ISSUE_810_SHUTDOWN_BUDGET` is three of those ticks — one re-poll, one grid displacement, one scheduler quantum — still 1/33 of `DEFAULT_REQUEST_TIMEOUT` and 1/200 of `DEFAULT_FRONT_TIMEOUT`, so a shutdown that waits for a session timeout misses it by two orders of magnitude. The test also asserts the four exchange counters it used to print and never check. Closes #1376. `log_frames` prints the decoded `:status` of every HEADERS frame, which is what surfaced the stream-7 404. `e2e/COVERAGE.md` and `CHANGELOG.md` carry the inventory, the 400-vs-404 decision and the tick derivation. `frames.is_empty()` as an accepted outcome is deliberately untouched and stays open on #1374. Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS
requested review from
Wonshtrum and
llenotre
as code owners
September 21, 2026 02:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three e2e assertions that passed while proving less than their names claimed. The production
diff is zero lines —
git diff <base> HEAD -- lib/ bin/ command/ sim/ fuzz/is empty — sothe "fix is test-shaped" check is vacuously N/A.
#1374 — nineteen indexed-status byte probes
All 19 (17 ×
contains(&0x8D), 2 ×contains(&0x88)) now go through one helper built on thedecode_statusfrom #1365.0x8Dis HPACK static index 13, which is:status 404— not 400.No live byte probe remains under
e2e/src/tests/.Every site turned out to mean 400; none meant 404. That was measured, not assumed:
log_frameswas patched to print the decoded
:statusand all 18 affected tests were run at baseline. Allfifteen
h2_security_tests.rssites answer with RST_STREAM and no HEADERS frame at all, sothe term was dead under either reading.
One site was not dead, and it is the important one.
test_h2_path_syntax_enforced'sdeliberately accepted asterisk-with-OPTIONS case answers
HEADERS flags=0x04 stream=7 len=48 status=404, whose indexed byte is exactly0x8D. Its innerprobe read that routed 404 as "sōzu emitted a 400". It stayed green only because the outer probe
was hardcoded to stream 1 while the case runs on stream 7 — two wrongs cancelling. Both are
now stream-scoped and decoded. That site's comment claiming
502 = 0x92is also corrected: 0x92is static index 18 (
content-type), and 502 is not in the static table at all.#1381 —
rejection || !got_200fail-opensBoth sites now assert the positive outcome and require that frames arrived at all.
A second fail-open turned up that the issue did not name:
got_rejection_or_421usedcontains_goaway, which matches any GOAWAY — including theerror_code=0x0graceful closethat rides behind the 421 in that very test. So a 502 plus that close satisfied "a 421 or GOAWAY
was observed", which is exactly the distinction the issue says these assertions cannot make.
Narrowed to
rejected_with_goaway_or_rst.The control runs are the decisive evidence. With an empty-frames fault injected, the historical
assertions pass and the new ones fail:
#1376 — the 100 ms budget
Derived, not raised until green. 100 ms is exactly one tick of the two grids the shutdown path
runs on:
reset_loop_time_and_get_timeoutclamps the poll timeout to a 100 msshutdown_tickwhile shutting down, and the timer wheel's
tick_msis 100 withduration_to_tickrounding tothe nearest tick, displacing a step by
(delay_ms + tick_ms/2) mod tick_ms∈ [0, 99] ms. Thebudget is 3 ticks = 300 ms — one re-poll, one grid displacement, one scheduler quantum —
still 1/33 of
DEFAULT_REQUEST_TIMEOUT.The test is also strengthened: four exchange counters it printed and never asserted are now
asserted. Injecting a deleted
client.receive()reddens it at 3.9 ms — inside budget, so thehistorical
duration > 100msbound would have passed that run.Deliberately not done
frames.is_empty()as an accepted outcome stays in two sites where it is documented policy.#1374 flags it as deserving its own look; tightening it is a behavioural change with its own
evidence to gather, and the commit and CHANGELOG say so.
BUILD=0 CLIPPY=0 TEST=0 FMT=0 CITATIONS=0. The 26 affected e2e tests were run by exact namewith default features:
test result: ok. 26 passed; 0 failed; finished in 1409.14s, includingtest_issue_810_timeout's full 100 iterations.Closes #1374
Closes #1376
Closes #1381