From 6a01043e1a53d9f42eff5e51678148b7bb8c75bc Mon Sep 17 00:00:00 2001 From: Stephen Halter Date: Tue, 11 Aug 2015 00:55:39 -0700 Subject: [PATCH] Fix ListenerSecondary so it reliably accepts new connections on Windows Calling uv_read_start on a named pipe with a larger than necessary buffer would cause pieces of the next uv_ipc_frame_uv_stream struct to be read into the uv_read_start buffer when a lot of tcp handles were passed quickly over the pipe. This prevented the struct from properly being queued for the next call to uv_accept to consume. The empty queue caused the call to uv_accept in ListenerSecondary to fail and return WSAEWOULDBLOCK leaving the connection in a zombie state. --- src/Microsoft.AspNet.Server.Kestrel/Http/ListenerSecondary.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerSecondary.cs b/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerSecondary.cs index 7bd97ed543..99b21897be 100644 --- a/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerSecondary.cs +++ b/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerSecondary.cs @@ -50,8 +50,8 @@ namespace Microsoft.AspNet.Server.Kestrel.Http try { - var ptr = Marshal.AllocHGlobal(16); - var buf = Thread.Loop.Libuv.buf_init(ptr, 16); + var ptr = Marshal.AllocHGlobal(4); + var buf = Thread.Loop.Libuv.buf_init(ptr, 4); DispatchPipe.ReadStart( (_1, _2, _3) => buf,