dotnet / dotnet/aspnetcore

HTTP/2 GOAWAY sent on connection that hasn't finished negotating

Open
#49,014 1 comment 0 reactions 0 assignees View on GitHub
area-networking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

HTTP/2 GOAWAY sent on a connection that still needs to finish negotiating. I don't know if this is a bug, but it seems weird and useless to send the GOAWAY.

Steps:
1. A client creates a socket to a Kestrel endpoint, and Kestrel decides the connection is HTTP/2 (it's HTTP/2 only, or maybe ALPN negotiation decided it's HTTP/2)
2. The socket never sends any content (i.e. the expected HTTP/2 preamble)
3. The server is stopped.
4. The server sends an HTTP/2 GOAWAY to the client.

Step four is unexpected. The client never started negotiating HTTP/2, but the server sent an HTTP/2 GOAWAY.

Example logs:

> 0.086s Microsoft.AspNetCore.Server.Kestrel.Connections - Debug: Connection id "0HMRLCFFCBH57" accepted.
> 0.086s Microsoft.AspNetCore.Server.Kestrel.Connections - Debug: Connection id "0HMRLCFFCBH57" started.
> 0.089s Microsoft.AspNetCore.Hosting.Diagnostics - Debug: Hosting shutdown
> 0.093s Microsoft.AspNetCore.Server.Kestrel.Http2 - Debug: Connection id "0HMRLCFFCBH57" is closing.
> 0.095s Microsoft.AspNetCore.Server.Kestrel.Http2 - Debug: Connection id "0HMRLCFFCBH57" is closed. The last processed stream ID was 0.
> 0.097s Microsoft.AspNetCore.Server.Kestrel.Http2 - Trace: Connection id "0HMRLCFFCBH57" sending GOAWAY frame for stream ID 0 with length 8 and flags 0x0.
> 0.100s Microsoft.AspNetCore.Server.Kestrel.Http2 - Debug: The connection queue processing loop for 0HMRLCFFCBH57 completed.
> 0.101s Microsoft.AspNetCore.Server.Kestrel.Connections - Debug: Connection id "0HMRLCFFCBH57" stopped.
> 0.101s Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets - Debug: Connection id "0HMRLCFFCBH57" sending FIN because: "The Socket transport's send loop completed gracefully."

### Expected Behavior

I would expect the server to close the connection without sending anything.

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version

_No response_

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.