From cd8e8f0a11cd29df8688cd1a14ef86236b087b28 Mon Sep 17 00:00:00 2001 From: Cesar Blum Silveira Date: Thu, 3 Mar 2016 08:56:22 -0800 Subject: [PATCH] Prevent DebugAssertException from blocks not returned by non-graceful shutdowns (#667). --- src/Microsoft.AspNetCore.Server.Kestrel/Http/Listener.cs | 6 +++--- .../Http/ListenerPrimary.cs | 4 ++-- .../Http/ListenerSecondary.cs | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Http/Listener.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Http/Listener.cs index 1a682f9a40..063d0a2f5f 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Http/Listener.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Http/Listener.cs @@ -98,9 +98,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http listener._closed = true; listener.ConnectionManager.WalkConnectionsAndClose(); - }, this); + }, this).ConfigureAwait(false); - await ConnectionManager.WaitForConnectionCloseAsync(); + await ConnectionManager.WaitForConnectionCloseAsync().ConfigureAwait(false); await Thread.PostAsync(state => { @@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http { writeReqPool.Dequeue().Dispose(); } - }, this); + }, this).ConfigureAwait(false); } Memory.Dispose(); diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Http/ListenerPrimary.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Http/ListenerPrimary.cs index 3e4c86c627..f2d9c2f3a9 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Http/ListenerPrimary.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Http/ListenerPrimary.cs @@ -105,7 +105,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http { // Call base first so the ListenSocket gets closed and doesn't // try to dispatch connections to closed pipes. - await base.DisposeAsync(); + await base.DisposeAsync().ConfigureAwait(false); if (Thread.FatalError == null && ListenPipe != null) { @@ -118,7 +118,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http { dispatchPipe.Dispose(); } - }, this); + }, this).ConfigureAwait(false); } } } diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Http/ListenerSecondary.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Http/ListenerSecondary.cs index 6e45fbf7ed..2e8e89911b 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Http/ListenerSecondary.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Http/ListenerSecondary.cs @@ -173,9 +173,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http listener._closed = true; listener.ConnectionManager.WalkConnectionsAndClose(); - }, this); + }, this).ConfigureAwait(false); - await ConnectionManager.WaitForConnectionCloseAsync(); + await ConnectionManager.WaitForConnectionCloseAsync().ConfigureAwait(false); await Thread.PostAsync(state => { @@ -185,7 +185,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http { writeReqPool.Dequeue().Dispose(); } - }, this); + }, this).ConfigureAwait(false); } else {