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
mux-h2: graceful_goaway clears zero.storage unconditionally, corrupting an in-flight header-block reassembly on every graceful shutdown #1398
Third instance of one bug class, and the only one that fires unconditionally.
ConnectionH2::zero is both the read-side accumulation buffer for a HEADERS+CONTINUATION field
block in progress — header_block_fragment is a (start, len) window into it that must stay valid
across however many readable() passes the block takes — and a write scratch space that several
code paths clear and reuse.
fix(mux-h2): defer control-frame flush during header-block reassembly #1397 — flush_pending_control_frames reused zero.storage for an unrelated WINDOW_UPDATE or
RST_STREAM and clobbered a legitimate reassembly mid-flight. Silent: the clobbered bytes still
HPACK-decode, producing a wrong header pair rather than an error.
This one is the same shape and worse.
The defect
graceful_goaway (lib/src/protocol/mux/h2.rs:5011) clears self.zero.storage at h2.rs:5029 to
serialize the initial advisory GOAWAY — unconditionally, with no check for a header block in
progress.
Its own comment states the intent to keep reading in-flight streams during the drain window. That
intent is exactly what the clear breaks: a stream whose HEADERS has arrived and whose CONTINUATION
has not has its accumulated fragment destroyed.
Unlike #1397's trigger, nothing needs to coincide. Every graceful shutdown and every hot reload that
lands mid-reassembly corrupts that stream, every time.
Expected
A drain that advertises "in-flight requests are still accepted" must not destroy an in-flight
request's own header block. Either defer the GOAWAY serialization the way #1397 defers the
control-frame drains, or give the GOAWAY its own buffer.
What a fix needs
A red-then-green regression test in the shape of #1397's a_legitimate_continuation_survives_an_unrelated_window_update_flush: send HEADERS without
END_HEADERS, trigger graceful_goaway, send the CONTINUATION, and assert the decoded field pair is
byte-for-byte what the peer encoded. Without the fix it must fail with a wrong pair, not a decode
error — that silence is the defining symptom of this class.
Worth checking in the same pass whether any other site clears zero.storage without consulting header_block_reassembly_in_progress() (h2.rs:3887, added by #1397). Three instances found by
three separate investigations suggests the invariant wants enforcing centrally rather than
site by site.
Activity