From 5fa658c8008eb932020675623d260f3d7394b568 Mon Sep 17 00:00:00 2001 From: Stephen Halter Date: Mon, 19 Mar 2018 17:29:49 -0700 Subject: [PATCH] Never run continuation inline in SocketAwaitable.OnCompleted (#2407) --- src/Kestrel.Transport.Sockets/Internal/SocketAwaitable.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Kestrel.Transport.Sockets/Internal/SocketAwaitable.cs b/src/Kestrel.Transport.Sockets/Internal/SocketAwaitable.cs index 1da07c9375..6c4de75c45 100644 --- a/src/Kestrel.Transport.Sockets/Internal/SocketAwaitable.cs +++ b/src/Kestrel.Transport.Sockets/Internal/SocketAwaitable.cs @@ -7,6 +7,7 @@ using System.IO.Pipelines; using System.Net.Sockets; using System.Runtime.CompilerServices; using System.Threading; +using System.Threading.Tasks; namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal { @@ -47,7 +48,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal if (ReferenceEquals(_callback, _callbackCompleted) || ReferenceEquals(Interlocked.CompareExchange(ref _callback, continuation, null), _callbackCompleted)) { - continuation(); + Task.Run(continuation); } }