Skip to content

Ignore DATA and HEADERS frames received after stream reset - #9697

Open
iVamsi wants to merge 4 commits into
lysine-dev:mainfrom
iVamsi:fix/http2-ignore-data-after-rst
Open

Ignore DATA and HEADERS frames received after stream reset#9697
iVamsi wants to merge 4 commits into
lysine-dev:mainfrom
iVamsi:fix/http2-ignore-data-after-rst

Conversation

@iVamsi

@iVamsi iVamsi commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

When OkHttp canceled or reset a stream, in-flight DATA frames arriving shortly after would find no active stream and trigger a redundant RST_STREAM with PROTOCOL_ERROR.

RFC 9113 requires discarding those late frames after sending RST_STREAM, while still counting DATA toward the connection flow-control window.

This change remembers recently reset stream IDs in a bounded set (256) and drops late DATA and HEADERS on those streams instead of sending another RST. Discarded DATA still updates connection flow control. DATA on idle or naturally finished streams is still PROTOCOL_ERROR.

This also resolves the flakiness in discardedDataFramesAreCounted.

Fixes #6171
Fixes #9672

iVamsi added 4 commits August 17, 2026 22:42
Track recently reset stream IDs in a bounded set so late in-flight frames on canceled or reset streams are discarded instead of triggering an erroneous RST_STREAM with PROTOCOL_ERROR. Leftover DATA bytes still count toward connection-level flow control.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Http2ConnectionTest.discardedDataFramesAreCounted flaky Send RST stream with PROTOCOL_ERROR when receive DATA frame after cancel stream

1 participant