Skip to content

HTTP/2: Correctly handle receiving multiple RST_STREAM frames #32442

@JamesNK

Description

@JamesNK

grpc/grpc-java#8142

tldr; Java gRPC client is sending two RST_STREAM frames for the same stream ID. Kestrel is killing the connection. This might not be correct.

Stream states section in the HTTP/2 spec: https://tools.ietf.org/html/rfc7540#section-5.1

When Kestrel receives the second RST_STREAM frame, it goes into a closed state.

  An endpoint MUST NOT send frames other than PRIORITY on a closed
  stream.  An endpoint that receives any frame other than PRIORITY
  after receiving a RST_STREAM MUST treat that as a stream error
  (Section 5.4.2) of type STREAM_CLOSED.  Similarly, an endpoint
  that receives any frames after receiving a frame with the
  END_STREAM flag set MUST treat that as a connection error
  (Section 5.4.1) of type STREAM_CLOSED, unless the frame is
  permitted as described below.

Kestrel should have a stream error rather than a connection error on the second RST_STREAM.

I'm not sure what a stream error would mean in this case as you're not allowed to send a RST_STREAM in response to a RST_STREAM - https://tools.ietf.org/html/rfc7540#section-5.4.2

An endpoint that detects a stream error sends a RST_STREAM frame
(Section 6.4) that contains the stream identifier of the stream where
the error occurred. The RST_STREAM frame includes an error code that
indicates the type of error.

And

To avoid looping, an endpoint MUST NOT send a RST_STREAM in response
to a RST_STREAM frame.

I think Kestrel should just ignore additional RST_STREAM frames.

Metadata

Metadata

Assignees

No one assigned

    Labels

    HTTP2area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsbugThis issue describes a behavior which is not expected - a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions