dotnet / dotnet/aspnetcore

C# client Stop can take a while if it spams Sends then tries to Stop

Open
#5,296 3 comments 0 reactions 0 assignees View on GitHub
affected-very-few area-signalr enhancement Perf severity-nice-to-have
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

```
while (someCondition == false)
{
_ = hubConnection.SendAsync("Ping");
}

// Takes a long time to complete
hubConnection.StopAsync();
// or
hubConnection.DisposeAsync();
```

The `SendAsync`'s are all waiting on a lock and when `StopAsync/DisposeAsync` tries to run it waits on the same lock. And I've observed it taking over a minute for the Stop/Dispose to finish

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.