Repository navigation
test(e2e): print hyper's error cause chain and name large-payload conjuncts - #1395
Merged
Merged
Conversation
Twice on 2026-09-21, on different crypto feature sets, an e2e request got
no response and the test printed only hyper's opaque outer message:
`hsts_tests::test_hsts_on_https_unreachable_503` printed "Could not get
response: client error (SendRequest)" and
`protocol_pair_matrix::basic_auth::test_h2_h1` printed "matrix request
failed: client error (SendRequest)". Neither was a timeout: both helpers
print a distinct timeout message at their 10 s deadline and neither
appeared, so the connection to sozu was closed before a response arrived
and the actual transport failure was discarded.
`client error (SendRequest)` is hyper's top-level Display; the
std::error::Error source chain underneath names the real cause (a TLS
alert, a ConnectionReset, an H2 GOAWAY) and was never walked. Add
`https_client::format_error_chain` -- one shared helper instead of
duplicating the walk at each call site -- and use it at every bare
`{error}` print in https_client.rs and protocol_pair_matrix.rs. An error
with no source renders identically to before, so no existing log line
loses information, and every existing distinct timeout message is
untouched.
Diagnostics only: no assertion, budget, conjunct or production code
changed.
To SEE THIS RED (probe, not committed): pointed a client at
`https://127.0.0.1:1`, an unused port.
bare: client error (Connect)
chained: client error (Connect) | caused by [1]: tcp connect error |
caused by [2]: Connection refused (os error 111)
Ran, with --nocapture:
`cargo +1.93.1 test -p sozu-e2e hsts_tests::test_hsts_on_https_unreachable_503`
and `cargo +1.93.1 test -p sozu-e2e protocol_pair_matrix::basic_auth::test_h2_h1`,
both `test result: ok. 1 passed; 0 failed`.
BUILD=0 CLIPPY=0 FMT=0 (cargo +1.93.1 build --all-features; cargo +1.93.1
clippy --all-features --all-targets -- -D warnings; cargo +nightly fmt
--all -- --check).
Ref: #1393
Signed-off-by: Florentin Dubois <[email protected]>
…ards
`tls_tests::try_tls_connection_close_large_response` collapsed six
distinguishable causes into one boolean and returned a bare `State::Fail`
with no output at all:
let response_ok =
headers.contains("HTTP/1.1 200") && body.len() == payload.len() && body == payload;
if success && response_ok && requests_received == 1 && responses_sent == 1 {
Report each conjunct with its values on failure. The distinction that
matters most for a large-response delivery guard is truncation (a short
body -- the sozu#1279 close-before-flush shape) versus corruption at
equal length, which the collapsed boolean could not tell apart; they are
now reported separately, corruption with the first differing byte
offset. The verdict is unchanged: `failures.is_empty()` holds exactly
when the original conjunction did (`body_ok` true with `length_ok` false
is unreachable -- equal strings have equal length).
`tcp_sni_tests::try_tcp_sni_large_payload_coalesced_with_hello_delivered_intact`
already prints `write_completed`, `backend_contacted`, `byte_identical`,
`routed_ok` and both byte counts unconditionally, and that existing line
is exactly how sozu#1393 was diagnosed. Only the two real gaps are
closed: `stopped`, computed after that line and previously silent, and
the truncation/corruption distinction inside `byte_identical` when the
two byte counts already match. Nothing that line already names is
reprinted.
A second, already-committed branch (test/large-payload-diagnostics,
1e101690) also touches both files. Its tls_tests.rs half is
byte-identical to this change. Its tcp_sni_tests.rs half is not kept: it
additionally reprints `write_completed` and `routed_ok` on failure,
which duplicates that same unconditional line despite its own commit
message calling itself "strictly additive" -- exactly the duplication
this change avoids.
Diagnostics only: no assertion, budget or production code changed.
To SEE THIS RED (probe, not committed):
tls_tests, 10 bytes dropped from the body before the checks:
TLS-CONN-CLOSE-LARGE: FAIL - body TRUNCATED or padded: got 262134
bytes, expected 262144
tcp_sni_tests, one byte flipped at offset 600000 after the join:
TCP-SNI-LARGE-COALESCED: FAIL - payload CORRUPTED at matching length
(1048832 bytes): first differing offset Some(600000)
Ran, with --nocapture:
`cargo +1.93.1 test -p sozu-e2e tls_tests::test_tls_connection_close_large_response`
and `cargo +1.93.1 test -p sozu-e2e tcp_sni_tests::test_tcp_sni_large_payload_coalesced_with_hello_delivered_intact`,
both `test result: ok. 1 passed; 0 failed`.
BUILD=0 CLIPPY=0 FMT=0 (cargo +1.93.1 build --all-features; cargo +1.93.1
clippy --all-features --all-targets -- -D warnings; cargo +nightly fmt
--all -- --check).
Ref: #1393
Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS
requested review from
Wonshtrum and
llenotre
as code owners
September 21, 2026 07:41
This was referenced Sep 21, 2026
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.
Addresses cause B of #1393 and the diagnosability gap that issue closes with.
Diagnostics only: no assertion, budget, conjunct or production code changes.
Cause B —
client error (SendRequest)had no cause chainTwice on CI, on different days and different crypto feature sets, a test got no response at all and
the helper printed only hyper's outer message:
hsts_tests::test_hsts_on_https_unreachable_503—Could not get response: client error (SendRequest)protocol_pair_matrix::basic_auth::test_h2_h1—matrix request failed: client error (SendRequest)Neither was a timeout — both helpers print a distinct message in that case and neither appeared. The
std::error::Errorsource chain underneath, which names the actual transport failure, was beingdiscarded.
https_client::format_error_chainnow walks.source()and renders<outer> | caused by [1]: … | caused by [2]: …, and every bare{error}print ine2e/src/mock/https_client.rsande2e/src/tests/protocol_pair_matrix.rsgoes through it. Measuredagainst a closed port:
The existing distinct timeout messages are untouched — the fact that they did not appear in either
failure is load-bearing evidence.
Naming the failing conjunct in two large-payload guards
tls_tests::test_tls_connection_close_large_responsehad the same bareassert_eq!(…, State::Success)shape and has never failed, so it was undiagnosable. It now nameswhich conjunct broke and distinguishes truncation from corruption. Verified by fault injection:
For
tcp_sni_tests, only what was previously silent is added —stopped, and the corruption offsetwhen the lengths match. That test already prints
write_completed,backend_contacted,byte_identicalandrouted_okunconditionally, and that existing print is exactly how #1393 wasdiagnosed, so it is not duplicated here.
The verdict is unchanged in both files.
Not included
Cause D of #1393, the 7 MB drain budget, is deliberately absent. Deriving it needs measured
local runs in the style of
ISSUE_810_SHUTDOWN_BUDGET; raising the bound to reach green is not onthe table, and a wrong derivation would be worse than an unchanged test. It stays open on #1393.