Repository navigation
test(mux-h2): wait for the writer before asserting the refused header block GOAWAY - #1804
Merged
Merged
Conversation
… block GOAWAY a_refused_header_block_counts_its_first_fragment_toward_its_size wrote its 66 000-byte block from a spawned thread and drove the connection for a fixed eight passes without waiting for it. On a loaded host the writer can be descheduled for the whole window, leaving nothing to read (`got []`), and a GOAWAY queued by the read of the last fragment in the final pass was never flushed, since only the next pass's writable() sends it. The test now drives until the GOAWAY reaches the peer, under a 30-second deadline, then joins the writer and requires its write to succeed before the unchanged assertion. With 24 busy loops on a 20-CPU host the test binary failed 2 of 200 runs before and 0 of 200 after. No other test spawns a writer thread: the other drive_and_read_backend callers write their small payloads synchronously before driving, and the remaining fixed-pass loops run over the in-memory PacedSocket. Signed-off-by: Florentin Dubois <[email protected]>
Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS
added a commit
that referenced
this pull request
Oct 2, 2026
## Summary The TLS handshake still treated an interrupted syscall (`EINTR`) as fatal: - `handshake_read` (`lib/src/protocol/rustls.rs`) sent an `Interrupted` error from `read_tls` to its generic arm, `HandshakeReadFault::ReadTls`, and `TlsHandshake::readable` closed the session; - the write pump of `TlsHandshake::writable` sent an `Interrupted` error from `write_tls` to its generic arm, which logged `Could not perform handshake` and closed the session. Both now retry the syscall at once, as `flush_tls` (#1795) and `rustls_socket_read` / the plain socket paths (#1802) do in `lib/src/socket.rs`. Only the syscall is retried. Readiness handling, the `ShortReadProbe` (it records only a successful read, so `was_short` stays exact) and the `READ_RESET`/`WRITE_RESET` counters are unchanged. The handshake write moves into `handshake_write`, which is generic over the transport like `handshake_read`, so a test can interrupt it. With #1802 merged, this was the last socket path that still treated `EINTR` as fatal. `origin/main` is merged into this branch, first at `11f12b76`, then at `82058124` (after #1789 and #1804). The first merge separates the two CHANGELOG entries with a blank line and replaces #1802's sentence "The TLS handshake pump … keeps its mapping" with one saying the pump now retries the same way. The second merge keeps both sets of tests in `lib/src/protocol/rustls.rs`, where this branch and #1789 each added tests at the same spot. The code merged cleanly. Fixes #1799 ## Tests - `an_interrupted_handshake_read_is_retried`: the first `recv` returns `Interrupted`. The test asserts that the retry reads the whole ClientHello short, READABLE drops, and the server queues its flight. - `an_interrupted_handshake_write_is_retried`: the first write returns `Interrupted`. The test asserts that the retry writes the flight and the client processes it. I wrote both tests before the retry arms, and both failed: `an interrupted read must be retried, not reported: ReadTls(Kind(Interrupted))` and `an interrupted write must be retried, not reported: Kind(Interrupted)`. After the fix, both pass. ## Validation (on the merge commit `07b036e8`) - `cargo +nightly fmt --check` -> exit 0 - `cargo +1.93.1 clippy --all-features --all-targets --locked -- -D warnings` -> exit 0 - `cargo +1.93.1 test -p sozu-lib --lib --all-features --locked` -> `test result: ok. 1570 passed; 0 failed` - `python3 .github/scripts/check_doc_citations.py --root . --base origin/main` -> exit 0 - `cargo test -p sozu-e2e --features opentelemetry,splice,simd tls -- --test-threads=4` -> `test result: ok. 44 passed; 0 failed` - `cargo test -p sozu-e2e --features opentelemetry,splice,simd -- --test-threads=4 half_close client_fin max_connections` -> `test result: ok. 12 passed; 0 failed` Signed-off-by: Florentin Dubois <[email protected]>
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.
Summary
protocol::mux::h2::tests::a_refused_header_block_counts_its_first_fragment_toward_its_sizeis flaky onmainwhen the host is busy and fails withgot [].Cause. The test writes its 66 000-byte block from a spawned thread, then calls
drive_and_read_backenda fixed eight times (each call runs 64 polling iterations withyield_now) without waiting for the writer. On a loaded host the writer can be descheduled for the whole window, so the connection reads nothing. There is a second, smaller window: the read of the last fragment queues the GOAWAY, and only the next iteration'swritable()flushes it. If that read happens in the final iteration, the GOAWAY is never sent.Fix (test only). The test now drives until the GOAWAY(ENHANCE_YOUR_CALM) reaches the peer, with a 30-second deadline. It then joins the writer and requires the write to succeed (previously the result was ignored), before the unchanged assertion. The loop and the assertion share one GOAWAY predicate. The assertion is unchanged, and the writer check is stricter than before.
Siblings. No other test has this race.
h2.rshas only onethread::spawn. The otherdrive_and_read_backendcallers write their small payloads synchronously before driving. The remaining fixed0..8loops run over the in-memoryPacedSocket.Evidence
Load: 24
sh -c 'while :; do :; done'busy loops on a 20-CPU host, tracked by PID and killed afterwards. Each run: the test binary with--exact protocol::mux::h2::tests::a_refused_header_block_counts_its_first_fragment_toward_its_size --test-threads=1undertimeout 120.mainatdc25d2ff): 2/200 failures, both... ENHANCE_YOUR_CALM), got []The test still catches its regression. With the
begin_header_block_if_newcall dropped inConnectionH2::discard_field_block, it fails once the 30-second deadline passes, withgot [(3, 0, 1, [0, 0, 0, 7])]. The doc comment now mentions that deadline.After the 200-run measurement I added only the
///doc sentence and the CHANGELOG entry. The full lib suite then ran green on the committed tree.Validation
cargo +nightly fmt --check-> exit 0cargo +1.93.1 clippy --all-features --all-targets --locked -- -D warnings-> exit 0cargo +1.93.1 test -p sozu-lib --lib --all-features --locked->test result: ok. 1544 passed; 0 failedpython3 .github/scripts/check_doc_citations.py --root . --base origin/main-> exit 0