If you get any of these errors, take a memory dump of your process, like I discuss below and look at the stacks.
- Create a memory dump for your slow performing Web App
- How to take a memory dump from a specific App Service instance
- Create and deploy an ASP.NET Core Web API to Azure Windows (see Figure 4)
- ASP.NET and ASP.NET Core Application Restarts on Azure App Service
I found this pattern in a Failed Request Trace log.
Once you get the memory dump, open it in WinDbg and Dump All Exceptions and you might see the following:
Type: Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException Message: Error -4077 ECONNRESET connection reset by peer Type: System.Threading.Tasks.TaskCanceledException Message: The request was aborted
Dump out all the threads and look for a stack similar to this:
libuv!uv_poll_ex libuv!uv_run Microsoft_ServiceBus!DomainBoundILStubClass.IL_STUB_PInvoke(Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvLoopHandle, Int32) Microsoft_AspNetCore_Server_Kestrel!Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.run(Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvLoopHandle, Int32) Microsoft_AspNetCore_Server_Kestrel!Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelThread.ThreadStart(System.Object)
Also, dump out the version of the Microsoft_AspNetCore_Server_Kestrel module:
lmvm Microsoft_AspNetCore_Server_Kestrel ..... ..... Image name: Microsoft.AspNetCore.Server.Kestrel.dll File version: 184.108.40.20631 Product version: 220.127.116.11 ....
If you find similar symptoms then the problem is that you need to update to at least 1.0.3, but recommend upgrading to the newest version, as of writing this article here, which is 1.1. 2.0 is available now also.
You can read more about this on GitHub:
- Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -4047 EPIPE broken pipe #1179#
- Ensure clients connecting to Kestrel's dispatch pipe are listeners
- UvException (Error -4047 EPIPE broken pipe) timing out HTTP requests #1182
UPDATE: Even after upgrading to ASP.NET Core 1.1 I was looking at a memory dump which had this exception in it: Error -4077 ECONNRESET connection reset by peer. This issue seems to explain that one. In the same dump I saw a vary long/tall stack which I translate into meaning that it has been running for some time. I was able to decompile the code and there were some data access and data processing methods running within while loops and foreach statements, another pattern that matches a slow running request. So, as this was running on an Azure App Service were there is a timeout of 230 seconds (which cannot be changed), I must agree that the exception "Error -4077 ECONNRESET connection reset by peer" comes from a timeout.