dotnet / dotnet/aspnetcore

[HTTP/3] Better handle connection close by browser

Open
#37,835 1 comment 0 reactions 0 assignees View on GitHub
area-networking HTTP3
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

When a browser is closed it shuts down the QUIC transport rather than aborting. That leaves unidirection control streams in an unhealthy state.

* Need to shutdown the connection with the minimum of errors and error logging.
* Skip writing GOAWAY frame if the transport is dead

We need to know whether a connection was aborted or shutdown which will require work in System.Net.Quic.

Example logs from browser close:
```
[13:45:13.266] dbug: HttpEventSourceListener[0]
<- Event Private.InternalDiagnostics.System.Net.Quic - Info : State#258006,NativeCallbackHandler,[conn][0x21660D75020] Connection received event SHUTDOWN_INITIATED_BY_TRANSPORT ->
[13:45:13.267] dbug: HttpEventSourceListener[0]
<- Event Private.InternalDiagnostics.System.Net.Quic - Info : State#9010854,HandleEvent,[strm][0x21660D762E0] Stream received event SHUTDOWN_COMPLETE ->
[13:45:13.267] dbug: HttpEventSourceListener[0]
<- Event Private.InternalDiagnostics.System.Net.Quic - Info : State#9010854,HandleEventConnectionClose,[strm][0x21660D762E0] Stream handling connection [conn][0x21660D75020] close with code 0 ->
[13:45:13.290] dbug: HttpEventSourceListener[0]
<- Event Private.InternalDiagnostics.System.Net.Quic - Info : State#16802227,HandleEvent,[strm][0x2166102F510] Stream received event SEND_SHUTDOWN_COMPLETE ->
[13:45:13.290] dbug: HttpEventSourceListener[0]
<- Event Private.InternalDiagnostics.System.Net.Quic - Info : State#16802227,HandleEvent,[strm][0x2166102F510] Stream received event SHUTDOWN_COMPLETE ->
[13:45:13.290] dbug: HttpEventSourceListener[0]
<- Event Private.InternalDiagnostics.System.Net.Quic - Info : State#16802227,HandleEventConnectionClose,[strm][0x2166102F510] Stream handling connection [conn][0x21660D75020] close with code 0 ->
[13:45:13.291] dbug: HttpEventSourceListener[0]
<- Event Private.InternalDiagnostics.System.Net.Quic - Info : State#258006,NativeCallbackHandler,[conn][0x21660D75020] Connection received event SHUTDOWN_COMPLETE ->
[13:45:13.291] dbug: Microsoft.AspNetCore.Server.Kestrel.Transport.Quic[11]
Stream id "0HMCO37DOFV64:00000002" read aborted by peer with error code 0.
[13:45:13.292] dbug: Microsoft.AspNetCore.Server.Kestrel.Transport.Quic[12]
Stream id "0HMCO37DOFV64:00000003" write aborted by peer with error code 0.
[13:45:13.292] dbug: Microsoft.AspNetCore.Server.Kestrel.Transport.Quic[10]
Stream id "0HMCO37DOFV64:00000003" shutting down writes because: "Connection aborted by peer (0).".
[13:45:13.273] dbug: Microsoft.AspNetCore.Server.Kestrel.Transport.Quic[5]
Connection id "0HMCO37DOFV64" aborted by peer with error code 0.
System.Net.Quic.QuicConnectionAbortedException: Connection aborted by peer (0).
at System.Net.Quic.Implementations.MsQuic.MsQuicConnection.AcceptStreamAsync(CancellationToken cancellationToken)
at System.Net.Quic.QuicConnection.AcceptStreamAsync(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal.QuicConnectionContext.AcceptAsync(CancellationToken cancellationToken) in C:\Development\Source\AspNetCore\src\Servers\Kestrel\Transport.Quic\src\Internal\QuicConnectionContext.cs:line 97
```

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.