Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Don't log ECONNRESET's between requests and during shutdown #1176

Closed
halter73 opened this issue Oct 21, 2016 · 2 comments
Closed

Don't log ECONNRESET's between requests and during shutdown #1176

halter73 opened this issue Oct 21, 2016 · 2 comments
Assignees
Milestone

Comments

@halter73
Copy link
Member

halter73 commented Oct 21, 2016

Connection resets between requests are fairly common and benign, so Kestrel shouldn't log this even at the informational level. Simply closing the browser (in this case IE 10) after a normal browsing session can lead to scary looking logs like the following as the browser closes its idle connections:

info: Microsoft.AspNetCore.Server.Kestrel[14]
      Connection id "0HKVPEE3563UP" communication error
Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -4077 ECONNRESET connection reset by peer
warn: Microsoft.AspNetCore.Server.Kestrel[0]
      Connection processing ended abnormally
System.IO.IOException: Error -4077 ECONNRESET connection reset by peer ---> Microsoft.AspNetCore.Server.Kestrel.Internal
.Networking.UvException: Error -4077 ECONNRESET connection reset by peer
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.SocketInput.CheckConnectionError()
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame`1.<RequestProcessingAsync>d__2.MoveNext()
info: Microsoft.AspNetCore.Server.Kestrel[14]
      Connection id "0HKVPEE3563UQ" communication error
Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -4077 ECONNRESET connection reset by peer
warn: Microsoft.AspNetCore.Server.Kestrel[0]
      Connection processing ended abnormally
System.IO.IOException: Error -4077 ECONNRESET connection reset by peer ---> Microsoft.AspNetCore.Server.Kestrel.Internal
.Networking.UvException: Error -4077 ECONNRESET connection reset by peer
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.SocketInput.CheckConnectionError()
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame`1.<RequestProcessingAsync>d__2.MoveNext()

In the case where Kestrel already logs "Some connections failed to close gracefully during server shutdown," we could also avoid logging the ECONNRESET communication error for each connection that was forcibly closed. This I'm less sure about since the ECONNRESET logs include the ConnectionIds of the relevant connection which could be useful.

@tugberkugurlu
Copy link

Has the fix for this been shipped? I am seeing a similar message (Error -104 ECONNRESET connection reset by peer) being logged at the information level still with Microsoft.AspNetCore.Server.Kestrel v1.1.0:

[foo-authorization-server-1]2017-04-08T07:43:52.044084770Z 2017-04-08 07:43:52 [Debug] Connection id ""0HL3TVDCICT0N"" started.
[foo-authorization-server-1]2017-04-08T07:44:01.770806308Z 2017-04-08 07:44:01 [Debug] Connection id ""0HL3TVDCICT0N"" reset.
[foo-authorization-server-1]2017-04-08T07:44:01.772359967Z 2017-04-08 07:44:01 [Information] Connection id ""0HL3TVDCICT0N"" request processing ended abnormally.
[foo-authorization-server-1]2017-04-08T07:44:01.772406521Z System.IO.IOException: Error -104 ECONNRESET connection reset by peer ---> Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -104 ECONNRESET connection reset by peer
[foo-authorization-server-1]2017-04-08T07:44:01.772413761Z    --- End of inner exception stack trace ---
[foo-authorization-server-1]2017-04-08T07:44:01.772417222Z    at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.SocketInput.CheckConnectionError()
[foo-authorization-server-1]2017-04-08T07:44:01.772433537Z    at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame`1.<RequestProcessingAsync>d__2.MoveNext()
[foo-authorization-server-1]2017-04-08T07:44:01.772521009Z 2017-04-08 07:44:01 [Debug] Connection id ""0HL3TVDCICT0N"" disconnecting.
[foo-authorization-server-1]2017-04-08T07:44:01.772598415Z 2017-04-08 07:44:01 [Debug] Connection id ""0HL3TVDCICT0N"" sending FIN.
[foo-authorization-server-1]2017-04-08T07:44:01.772701286Z 2017-04-08 07:44:01 [Debug] Connection id ""0HL3TVDCICT0N"" sent FIN with status "-107".
[foo-authorization-server-1]2017-04-08T07:44:01.772779160Z 2017-04-08 07:44:01 [Debug] Connection id ""0HL3TVDCICT0N"" stopped.
[foo-authorization-server-1]2017-04-08T07:44:01.772907402Z 2017-04-08 07:44:01 [Debug] Connection id ""0HL3TVDCICT0N"" disconnecting.
[foo-authorization-server-1]2017-04-08T07:44:01.773174672Z 2017-04-08 07:44:01 [Debug] Connection id ""0HL3TVDCICT0N"" write of "0" bytes to disconnected client.

@halter73
Copy link
Member Author

@tugberkugurlu Kestrel will still log ECONNRESETs that occur mid-request which is likely what's happening here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants