Potential out of memory with slow SignalR clients
Open
area-signalr
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 276
Description
I noticed the SignalR client connection receive loop uses an unbounded receive buffer [here](https://github.com/dotnet/aspnetcore/blob/4c300ec6db7117a05b7c79cf6f617e9d498212b6/src/SignalR/clients/csharp/Client.Core/src/HubConnection.cs#L1273). If I read the code correctly it looks like network backpressure is not applied in the opposite direction - from the runtime into the receive loop. In theory, if an app is very slow to process the received messages, it is entirely possible for the `invocationMessageChannel` to grow until the application runs out of memory.
Can the code be refactored to use a bounded channel instead, with a configurable maximum size?
Contributor guide
Assessment
This issue has not been assessed yet.