diff --git a/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/KestrelThread.cs b/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/KestrelThread.cs index e24b4e1f12..821a8216da 100644 --- a/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/KestrelThread.cs +++ b/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/KestrelThread.cs @@ -153,6 +153,18 @@ namespace Microsoft.AspNet.Server.Kestrel _post.Reference(); _post.DangerousClose(); + _engine.Libuv.walk( + _loop, + (ptr, arg) => + { + var handle = UvMemory.FromIntPtr(ptr); + if (handle != _post) + { + handle.Dispose(); + } + }, + IntPtr.Zero); + // Ensure the "DangerousClose" operation completes in the event loop. var ran2 = _loop.Run();