Skip to content

h2: removing a stream parked mid-frame leaves a truncated frame on the wire #1604

Closed

Description

@FlorentinDUBOIS

Found by the adversarial review of #1601. The bug predates that PR, which does not make it worse.

Problem

A stream frame (HEADERS/DATA) is written from the stream's own kawa.out. When a write is partial, the stream is parked with expect_write = Some(Other{..}) and the rest of the frame is written on a later pass.

If that parked stream is removed before the rest goes out, the partial frame stays truncated on the wire. The next bytes sozu writes on the connection then land inside what the peer still parses as that frame: a control frame, a GOAWAY, or another stream's frame. The peer desynchronises. Removal paths include a peer RST, end_stream, expiry and prune_inactive_streams_while_closing (seen removing an Idle parked stream in GoAway state). H2StreamTable::remove has more than 15 callers through remove_dead_stream.

Root cause

zero is both the frame-header input buffer and the control-frame output buffer. Stream frames are serialised against it only through expect_write, not through a single ordered output buffer. HAProxy copies every whole frame into one output ring (mbuf, src/mux_h2.c), so a stream closing can never truncate a frame that is already queued.

Options (operator decision)

Activity

  1. added a commit that references this issue on Sep 27, 2026
    58550dd
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