Skip to content

Ignore DATA frames received on a stream reset before any DATA arrived - #1250

Open
arturobernalg wants to merge 1 commit into
apache:mainfrom
arturobernalg:h2-data-after-reset
Open

arturobernalg wants to merge 1 commit into
apache:mainfrom
arturobernalg:h2-data-after-reset

Conversation

@arturobernalg

@arturobernalg arturobernalg commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

RFC 9113, section 5.1 requires an endpoint that has reset a stream to "minimally process and then discard" the frames it receives on it, as the client may have sent them before it saw the reset.

When a stream is closed before any DATA frame has been processed, Stream.replace() creates the RecycledStream with no flow control window left, so any DATA that is still in flight is answered with RST_STREAM (FLOW_CONTROL_ERROR). Each of those counts towards the overhead limit, so after a few frames the connection is closed with GOAWAY (ENHANCE_YOUR_CALM), which also kills every other stream on it. This happens, for example, when a request is rejected without its body being read.

As no DATA has been received, the client still has the whole initial window available. Create the RecycledStream with it. A client that really exceeds the window is still reset.

Checked against a running Tomcat with a raw HTTP/2 client, sending DATA to a stream the server had just reset: without the change 100 bytes already got a RST_STREAM, and 49 KiB (inside the window) got two of them and a GOAWAY that closed the connection. With it the frames are ignored and the connection stays usable. 80 KiB, which exceeds the window, is still reset. The HTTP/2 test suite passes.

This is the stream the server reset (CLOSED_RST_TX), not the one handled by #1129.

RFC 9113, section 5.1 requires an endpoint that has reset a stream to
minimally process and then discard the frames it receives on it. When a
stream was closed before any DATA frame had been processed, the
replacement RecycledStream was created with no flow control window left.
A client that had already sent DATA, well inside the window it was
allowed, was answered with a RST_STREAM (FLOW_CONTROL_ERROR) for every
frame and, as each of those counts towards the overhead limit, the whole
connection was then closed with a GOAWAY (ENHANCE_YOUR_CALM). This
happens, for example, when a request is rejected without its body being
read.

Create the RecycledStream with the full initial window when no DATA
frame has been received.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant