Normal operations inner exceptions of ManagedWebsocket lead to big percentage of all thrown exceptions
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
### Description
Any big websocket service will naturally have clients suddenly disconnecting, sending cancelled, etc. There's almost no way to proactively guard from it. Current design of .NET BCL means this events lead to exception. That much is expected.
Even if one tries to proactively limit the number of actually thrown exceptions via configureoptions `SuppressThrowing`, there's still a _lot of_ exceptions thrown within the ManagedWebSocket for control flow.
Namely we see following callstacks (most often ReceiveAsyncPrivate):
### Configuration
Windows, http.sys, .NET 9; but it seems to be not tied to either platform of http server.
### Regression?
No
### Data
See above
### Ask:
I understand big changes might be problematic, but wouldn't it be possible to change ReceiveAsyncPrivate to do controll flow _without_ throwin (and frequently catching) exceptions? But instead just return?
### Analysis
Exceptions above are > 10 % of all exceptions thrown in our (very big) websocket as a service service (hundreds of millions users daily).
Contributor guide
Assessment
This issue has not been assessed yet.