Repository navigation
Description
Summary
tests::tcp_sni_tests::test_tcp_sni_large_payload_coalesced_with_hello_delivered_intact fails
deterministically under --release, in isolation, on an idle machine, in ~0.05 s. It is not a
flake. The worker logs a spin to MAX_LOOP_ITERATIONS and closes a connection that has delivered
0 of 1 048 832 bytes.
CI runs the debug profile, where the same race is usually won; load is what loses it. That is why this
has been showing up as an intermittent e2e failure and being re-run away.
Reproducer
cargo +1.93.1 test -p sozu-e2e --release -- --exact \
tests::tcp_sni_tests::test_tcp_sni_large_payload_coalesced_with_hello_delivered_intact
Mechanism
Identical in every observed failure:
Handling session went through 100000 iterations, there's a probable infinite loop bug, closing the connection
Frontend: interest: R-EH, readiness: RW--, mixed: R---
Backend: interest: -WEH, readiness: ---- status: Connecting(...)
Metrics: bin: 16384, bout: 0, backend_connected: None
The frontend buffer fills at 16 384 B while the backend is still Connecting. The session can neither
drain — the backend is not writable — nor clear its readable event, so it spins to
MAX_LOOP_ITERATIONS and the connection is closed. routed_ok=true: routing succeeds, this is the
datapath after it.
Under --release the 1 MB write outruns the backend connect every time. Under debug it usually does
not, which is why an idle debug run passes.
Measurements
| tree | profile | result |
|---|---|---|
ba7fa5f9 (main) |
--release, isolated, idle |
0 pass / 5 fail |
ba7fa5f9 (main) |
--release, isolated |
0 pass / 10 fail (independent run) |
ba7fa5f9 (main) |
debug, isolated | 5 pass / 0 fail |
ba7fa5f9 (main) |
debug, isolated, CI fips flags |
5 pass / 0 fail |
8fed9b71 (pre-#1370) |
--release, isolated |
0 pass / 5 fail |
Two independent operators, same mechanism in all 25 release-profile failures.
Not introduced by a recent merge. The pre-merge parent 8fed9b71 reproduces identically, so
#1363, #1367 and #1370 are excluded. The test and the SNI+ALPN pre-read feature both arrive in
2ed35c86 (#1279); the defect plausibly dates from there, but that has not been measured and is
not claimed.
Why this matters beyond one test
The same family has produced repeated CI failures across unrelated branches — including on main
itself and on pull requests that change only documentation — and each was re-run rather than
investigated, because the failure is unreadable.
The verdict at e2e/src/tests/tls_tests.rs:1172 collapses six distinguishable causes into one
boolean with no output:
if success && response_ok && requests_received == 1 && responses_sent == 1
// where response_ok = headers.contains("HTTP/1.1 200")
// && body.len() == payload.len()
// && body == payloadFor a coalescing bug the most diagnostic distinction in that set — truncation (length differs) versus
equal-length corruption (bytes differ) — is exactly the one discarded. A separate change makes these
verdicts self-diagnosing.
Suggested direction
The spin is the bug; the test is only the witness. A session whose frontend buffer is full while its
backend is still connecting has no readable progress to make, and re-entering the loop cannot change
that until the connect completes. Either the readable interest should be cleared until the backend is
writable, or the loop should yield rather than re-entering. Which is correct is a maintainer call —
the important part is that it is reproducible in 0.05 s and does not need CI to observe.
Activity
fix(tcp): stop re-arming frontend-readable on a routed SNI preread
test(e2e): raise the large-body H2 drain budget from 8s to 30s