Kestrel: handling of FIN comming from client
See original GitHub issueThis issue has been talked about in the archived repo aspnet/KestrelHttpServer SocketTransport: FIN handling but I’m not sure what the outcome is. I’ve search for commits mentioned in issue 1774 in this repo but found nothing.
My problem is that a TCP client is making an HTTP POST request to an ASP.NET Core WebAPI. After getting back an ACK the client sends immediately FIN, ACK. Subsequently, Kestrel closes the connection so the client does not get the response. Although the corresponding MVC action finishes and returns an IActionResult. No error/warning is raised on the server-side.
Lib: Microsoft.AspNetCore.App: 2.2.6 Runtime: netcoreapp2.2 OS: Windows 10 x64 SDK: 2.2.301
You can see the actual behavior in this screenshot of the communication captured with wireshark. Port 51852 is the client initiating the connection. Port 6200 is Kestrel.

I tested the same a client with a mock service (SoapUI) that provides the expected behavior.

By the way: using HttpSys an exception is thrown if my action returns, i.e. both servers have different behavior.
Microsoft.AspNetCore.Server.HttpSys.MessagePump[0]
ProcessRequestAsync
System.InvalidOperationException: Headers already sent.
at Microsoft.AspNetCore.Server.HttpSys.Response.CheckResponseStarted()
at Microsoft.AspNetCore.Server.HttpSys.FeatureContext.ConsiderEnablingResponseCache()
at Microsoft.AspNetCore.Server.HttpSys.FeatureContext.OnResponseStart()
at Microsoft.AspNetCore.Server.HttpSys.MessagePump.ProcessRequestAsync(Object requestContextObj)
at Microsoft.AspNetCore.Server.HttpSys.MessagePump.ProcessRequestAsync(Object requestContextObj)
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (7 by maintainers)
Top Related StackOverflow Question
2 years later lots of people using Kestrel “on the edge” 😉
This issue hasn’t had any external activity in over a year, and I think we’re happy with the current behavior.