Repository navigation
test(e2e): wait for the request before soft-stopping the large-transfer drain test - #1739
Merged
Merged
Conversation
…nfinished request test_h1_trailer_field_limit_exceeded_split_closes_backend (#1719) checked that a follow-up request on the same client connection was served after a 400 for an over-bound trailer section. #1726, merged first, closes the H1 client connection when a response completes before its request was received whole. An over-bound trailer section leaves the request unfinished: its end cannot be found, so no further request can be read from that connection (RFC 9112 §6.3). The close is the intended behaviour, and the follow-up expectation contradicted it, which turned main red. The test now checks that, after the 400, the client connection reads EOF with no further bytes and that a follow-up request reaches no backend. The other checks are unchanged: head and body forwarded, 400 answered, backend connection holding the cut request closed. Since #1726, removing the block of ConnectionH1::readable that ends the backend stream before the 400 no longer turns this test red: the client close tears the backend down too. The test doc says so. The 400 arm of #1719 has no dedicated unit test. CHANGELOG (#1716 entry), kawa_h1/LIFECYCLE.md §2.3 and the 400-arm comment in mux/h1.rs said the client connection stays as persistent as the answer's Connection header; they now say it closes. No runtime change. Follow-up to #1719 and #1726. Signed-off-by: Florentin Dubois <[email protected]>
…er drain test test_h2_graceful_shutdown_completes_large_transfer slept a fixed 200 ms after starting its request and then issued soft_stop, assuming the request had reached the backend. Under load it had not: the worker rightly refused the not-yet-opened connection or stream, and the test failed with a connection-level error (connection refused, broken pipe, connection closed) without ever exercising the in-flight drain it covers. The backend now holds its response (DelayedH2Backend::start_held), the test waits until the request has reached it, issues soft_stop, then releases the 512 KiB response, so the response is still owed when the soft stop is issued at any load. No production code changed. Fixes #1736 Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS
force-pushed
the
fix/e2e-h2-graceful-shutdown-race
branch
from
October 1, 2026 11:23
f5cad40 to
f611432
Compare
FlorentinDUBOIS
added a commit
that referenced
this pull request
Oct 1, 2026
Follow-up to #1719. ## Problem #1719 made both `Position::Server` arms of the parse-error branch in `ConnectionH1::readable` (`lib/src/protocol/mux/h1.rs`) end the linked backend stream. Only the cut-response arm has a unit test. The 400 arm relied on the e2e test `test_h1_trailer_field_limit_exceeded_split_closes_backend`, which no longer catches a regression there: since #1726 the client connection closes after a 400 for an unfinished request, and that close tears the backend down too (see #1748). ## Change Test only. `a_request_error_answered_400_after_linking_ends_the_backend_stream` links a pooled mock H1 backend and reads its complete response without starting it on the client's wire, then sends a malformed chunk. It asserts that the request is answered on the client connection, that the stream leaves `backend_streams`, and that the backend no longer carries it and is `Disconnecting`, not pooled. The CHANGELOG #1716 entry names the new test. ## Test Red, on a `git archive` copy with the 400-arm block removed: ``` test protocol::mux::h1::tests::a_request_error_answered_400_after_linking_ends_the_backend_stream ... FAILED panicked at lib/src/protocol/mux/h1.rs:2677:9: the rejected stream must leave the backend reverse index test result: FAILED. 2 passed; 1 failed ``` Green, on this branch: ``` test protocol::mux::h1::tests::a_request_error_answered_400_after_linking_ends_the_backend_stream ... ok test result: ok. 3 passed; 0 failed ``` ## Validation | Check | Exit code | Result | |---|---|---| | `cargo +nightly fmt --all --check` | 0 | | | `cargo +1.93.1 clippy --all-features --all-targets --locked -- -D warnings` | 0 | | | `RUSTDOCFLAGS="-D warnings" cargo doc --all-features --no-deps` | 0 | | | `cargo test -p sozu-lib --all-features --locked` | 0 | 1465 unit tests passed; integration tests passed | | `cd fuzz && cargo +nightly fuzz build` | 0 | | | `check_doc_citations.py` `--self-test`, `--root .`, `--root . --base origin/main`, `--audit --root .` | 0, 0, 0, 0 | | Stacked on #1739. 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.
test_h2_graceful_shutdown_completes_large_transferslept a fixed 200 ms beforesoft_stop, assuming its request had reached the backend. Under load it had not, so the worker refused the not-yet-opened connection or stream and the test failed without exercising the drain.The backend now holds its response (
DelayedH2Backend::start_held), the test waits until the request has reached it, issuessoft_stop, then releases the response. The response is therefore still owed when the drain starts, independent of load. Test-only change; CHANGELOG updated.A distinct, rarer reset of an already-completed response under heavy load remains and is out of scope for this change.
Fixes #1736
Stacked on #1748.