Skip to content

HTTP2: Canceling token given to HttpClient.SendAsync does not send RST_STREAM #30791

@JamesNK

Description

@JamesNK

Found by a customer: https://twitter.com/stevejgordon/status/1169995743568048129

This is a high impact bug. A user will cancel a streaming gRPC call on the client, but the server will never be notified. If the server is checking CancellationToken.IsCancellationRequested then it will hang open forever.

This is a regression of https://github.com/dotnet/corefx/issues/38391

Related: https://github.com/dotnet/corefx/issues/39049


Repro:

  1. git clone https://github.com/JamesNK/grpc-dotnet.git
  2. git checkout jamesnk/duplex-cancellation-regression
  3. dotnet test test\FunctionalTests --filter Name~ServerStreaming_CancellationOnClient_SentToServer

Logic in the test is something like:

  1. Client makes a server streaming call to the server. This means the client is sending one message in the request's HttpContent, which then completes.
  2. Server streams multiple messages to the client
  3. Client triggers the cancellation token given to gRPC client. HttpClient.SendAsync token is canceled
  4. The HttpClient should be sending RST_STREAM to the server, and the server should report the call is canceled. This isn't happening so the server will stream messages forever.

Wireshark log: cancellation-regression.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions