Repository navigation
Description
Summary
In kawa_h1, a frontend timeout can be consumed without being re-armed, leaving a session with no
armed timer at all — alive until the 30-minute zombie_check sweeps it. This is structurally the
same defect mux already found and patched for itself, with the same "partial flush" cause.
Reported as pre-existing and unfixed; found while auditing timer handling for a separate UDP fix.
Mechanism
kawa_h1/mod.rs:2388 calls container_frontend_timeout.triggered(), which consumes the handle. The
TimeoutStatus::Request arm then sets a 408 answer and returns self.writable(metrics).
- The frontend container is re-armed in exactly one place,
readable()(kawa_h1/mod.rs:406),
which will not run again — the request is finished and the session is flushing a default answer. - In the
Requestcase the backend was never reached, socontainer_backend_timeoutis unarmed too.
So if writable returns Continue on a partial flush, the session holds no armed timer on either
side. Nothing reaps it until zombie_check (lib/src/server.rs:1344), which runs on a 30-minute
cadence.
TimeoutStatus::WaitingForResponse (kawa_h1/mod.rs:2400-2406) appears to be the same shape and
should be assessed with it.
Why this looks like a known class rather than a novel finding
mux carries the fix for exactly this, with a comment naming the consequence:
mux/mod.rs:1565-1566re-armsbackend.timeout_container().set(token)underif !should_close,
commented "Without this, the timeout is consumed and the session becomes immortal until the zombie
checker runs".mux/mod.rs:1603-1604does the same for the frontend underif result == StateResult::Continue,
plus further sites at1616and1646.
So the pattern — consume on delivery, re-arm explicitly when the session survives — is already the
house rule in the sibling protocol. kawa_h1 follows it on the paths that hand responsibility to the
sibling container (TimeoutStatus::Response, re-armed via reset()), but not on this one.
Caveat that may make this moot
See #1346: kawa_h1::Http may not be constructed by any Sōzu binary at all. HttpStateMachine and
HttpsStateMachine have no kawa_h1::Http variant, and Http::new has no code callers. If that is
right, this path is unreachable in production and the correct resolution is whatever #1346 concludes
about the module as a whole, not a patch here.
Filing it separately anyway, because the two questions are independent: if kawa_h1 is retained for
any reason, this defect is in it.
Suggested direction
Mirror mux/mod.rs:1603-1604: re-arm the frontend container when the arm returns Continue. Worth
checking at the same time whether any other kawa_h1 timeout arm consumes without re-arming or
handing off.
Provenance
Source-derived. The consuming call, the single re-arm site, and the mux counterpart were each read
directly; the partial-flush path was not exercised against a live proxy.
Activity
refactor(kawa_h1): drop the unreachable Http session state machine