Skip to content

Send RST stream with PROTOCOL_ERROR when receive DATA frame after cancel stream #6171

Open

Description

@tmpdat

Following log on http / 2 server, I noticed that okhttp3.12.8 sent RST stream with PROTOCOL_ERROR when receiving DATA frame after canceling the stream.

This doesn't seem to be true for the HTTP / 2 specification, but only for SPDY in the Stream state: closed section (https://http2.github.io/http2-spec/#StreamStates):

HTTP / 2 specification:
"If this state is reached as a result of sending a RST_STREAM frame, the peer that receives the RST_STREAM might have already sent - or enqueued for sending - frames on the stream that cannot be withdrawn. An endpoint MUST ignore frames that it receives on closed streams after it has sent a RST_STREAM frame. An endpoint MAY choose to limit the period over which it ignores frames and treat frames that arrive after this time as being in error. "
SPDY specification (SPDY Protocol - Draft 3 https://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3-1#TOC-2.3.7-Stream-close):
"If an endpoint receives a data frame after the stream is closed, it must send a RST_STREAM to the sender with the status PROTOCOL_ERROR."

This is causing the server to acknowledge an error, wasting sending / receiving RST frames on client / server.

I have tried to find this error in Okhttp's Change log but have not seen it. So, I hope Okhttp can reconsider this if it has never been mentioned. Thanks.

Activity

  1. added
    enhancement
    on Jul 6, 2020
  2. swankjesse commented on Jul 6, 2020

    @swankjesse
    Collaborator

    Seems like something we should fix.

  3. added this to the Backlog milestone on Aug 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions