-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Description
Describe the bug
When a client abruptly disconnects, the IO exceptions on the server side are logged as "errors" under .NET runtime. There is nothing the server can do about client disconnects. This is happening due to this line :
aspnetcore/src/Servers/HttpSys/src/RequestProcessing/RequestStream.cs
Lines 288 to 289 in ff9ed0f
Exception exception = new IOException(string.Empty, new HttpSysException((int)statusCode)); | |
Log.ErrorWhenReadAsync(Logger, exception); |
These IO Exceptions due to client disconnects are not reported as errors on IIS.
To Reproduce
-
Fire up any HttpSysServer sample project in Visual Studio: https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/fundamentals/servers/httpsys/samples/3.x/SampleApp
-
Send requests to both servers and abruptly disconnect your client. I've attached a simple TCPClient I used.
TCPClient.zip -
You will notice the exceptions listed below emitted as errors under ".NET Runtime"
Exceptions (if any)
- ReadAsync
Exception:
System.IO.IOException
---> Microsoft.AspNetCore.Server.HttpSys.HttpSysException (1): Incorrect function.
--- End of inner exception stack trace ---
- ReadAsync
Exception:
System.IO.IOException
---> Microsoft.AspNetCore.Server.HttpSys.HttpSysException (64): The specified network name is no longer available.-
--- End of inner exception stack trace ---
-->
- ReadAsync
Exception:
System.IO.IOException
---> Microsoft.AspNetCore.Server.HttpSys.HttpSysException (1229): An operation was attempted on a nonexistent network connection.
--- End of inner exception stack trace ---
- ReadAsync
Microsoft.AspNetCore.Server.HttpSys.HttpSysListener[31]
Exception:
System.IO.IOException
---> Microsoft.AspNetCore.Server.HttpSys.HttpSysException (1229): An operation was attempted on a nonexistent network connection.
--- End of inner exception stack trace ---
This is a screenshot of the errors from Windows EventViewer.
Further technical details
- ASP.NET Core version : .NET 6.0 preview 7.
- Include the output of
dotnet --info
- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version