Skip to content

Normal operations inner exceptions of ManagedWebsocket lead to big percentage of all thrown exceptions #119843

@petrroll

Description

@petrroll

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):

Image Image Image

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).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions