Closed
Description
I have a test that:
- Creates a HttpClient
- Uses HttpClient to call Kestrel (this creates a QUIC connection)
- Disposes HttpClient (expect QUIC connection to be closed)
I expected that step 3 would trigger the client to send a GOAWAY and close the connection, and the server to receive a notification. The server has a pending call on AcceptStreamAsync
that should throw. Instead, the connection stays open and the server patiently waits.
I wrote a test that uses QuicConnection directly and the expected abort happened on the server when the client called QuicConnection.CloseAsync
.
Test in PR: dotnet/aspnetcore#34968
Test name: GET_ClientDisconnected_ConnectionAbortRaised
Client related code:
using (var host = builder.Build())
{
await host.StartAsync();
var client = CreateClient();
try
{
var port = host.GetPort();
// Act
var request1 = new HttpRequestMessage(HttpMethod.Get, $"https://127.0.0.1:{port}/");
request1.Version = HttpVersion.Version30;
request1.VersionPolicy = HttpVersionPolicy.RequestVersionExact;
var response1 = await client.SendAsync(request1);
response1.EnsureSuccessStatusCode();
await connectionStartedTcs.Task.DefaultTimeout();
}
finally
{
Logger.LogInformation("Disposing client.");
client.Dispose();
}
Logger.LogInformation("Waiting for server to receive connection close.");
await connectionClosedTcs.Task.DefaultTimeout();
await host.StopAsync();
}