You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
h2: removing a stream parked mid-frame leaves a truncated frame on the wire #1604
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)
(a) Keep the unwritten bytes of the current frame when the stream is removed. This needs the frame boundary in out and a signature change on every remove_dead_stream caller.
(b) Defer removing a parked stream until its frame has been written. This touches every removal site.
(c) A "poisoned wire" state: block every writer and force_disconnect, so the connection drops on every cancel under backpressure.
Activity
fix(mux-h2): send every committed frame whole through one ordered out…
fix(mux-h2): send every committed frame whole through one ordered out…