Skip to content

kawa_h1: a frontend timeout can be consumed without re-arming, leaving the session to zombie_check #1347

Closed

Description

@FlorentinDUBOIS

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 Request case the backend was never reached, so container_backend_timeout is 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-1566 re-arms backend.timeout_container().set(token) under if !should_close,
    commented "Without this, the timeout is consumed and the session becomes immortal until the zombie
    checker runs"
    .
  • mux/mod.rs:1603-1604 does the same for the frontend under if result == StateResult::Continue,
    plus further sites at 1616 and 1646.

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

  1. added a commit that references this issue on Sep 20, 2026
    af6a2f5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions