diff --git a/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionListener.cs b/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionListener.cs index 6f6e10f867..ccdb774674 100644 --- a/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionListener.cs +++ b/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionListener.cs @@ -118,6 +118,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets // A call was made to UnbindAsync/DisposeAsync just return null which signals we're done return null; } + catch (SocketException e) when (e.SocketErrorCode == SocketError.OperationAborted) + { + // A call was made to UnbindAsync/DisposeAsync just return null which signals we're done + return null; + } catch (SocketException) { // The connection got reset while it was in the backlog, so we try again. diff --git a/src/Servers/Kestrel/test/FunctionalTests/UnixDomainSocketsTests.cs b/src/Servers/Kestrel/test/FunctionalTests/UnixDomainSocketsTests.cs index b16863b3af..8add576c07 100644 --- a/src/Servers/Kestrel/test/FunctionalTests/UnixDomainSocketsTests.cs +++ b/src/Servers/Kestrel/test/FunctionalTests/UnixDomainSocketsTests.cs @@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Connections.Features; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing.xunit; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Testing; using Xunit; @@ -49,6 +50,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests if (result.IsCompleted) { + Logger.LogDebug("Application receive loop ending for connection {connectionId}.", connection.ConnectionId); break; } @@ -59,7 +61,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests } catch (OperationCanceledException) { - + Logger.LogDebug("Graceful shutdown triggered for {connectionId}.", connection.ConnectionId); } }