Streaming UnsubscribeAsync timeout on deactivate
- Dominant language
- C#
- Stars
- 10.9k
- Forks
- 2.1k
- Avg merge
- 14h 42m
- Merged PRs (30d)
- 354
Description
We have been experiencing several timeouts in SMS and now im trying to do some changes to help it improve (or try understand from where); and now it seems that when we call `UnsubscribeAsync` there's a great chance that it hangs, currently its on `OnDeactivateAsync` but I will test even further
This is the error thrown after timeout's
```
[14:47:39 ERR] [Orleans.Runtime.Catalog] Error calling grain's OnDeactivateAsync() method - Grain type = SignalR.Orleans.Groups.GroupGrain Activation = [Activation: S127.0.0.1:11111:313249616*grn/B47CEF79/00000000+HeroHub:hero:all@40771ea9 #GrainType=SignalR.Orleans.Groups.GroupGrain Placement=RandomPlacement State=Deactivating]
System.Threading.Tasks.TaskCanceledException: A task was canceled.
at async Task Orleans.OrleansTaskExtentions.MakeCancellable(Task task, CancellationToken cancellationToken) in D:/build/agent/_work/25/s/src/Orleans.Core/Async/TaskExtensions.cs:line 346
at async Task Orleans.Runtime.Catalog.CallGrainDeactivateAndCleanupStreams(ActivationData activation, CancellationToken ct) in D:/build/agent/_work/25/s/src/Orleans.Runtime/Catalog/Catalog.cs:line 1183
```
Basically its hanging in the await of the breakpoint - i had tried several different options like manual loops instead of `Select`, or so but still same issue

It should work doing `UnsubscribeAsync` on `OnDeactivateAsync`
Using Orleans: 2.3.5 (tried also with 2.4.4)
Running on Windows 10 (local)
NOTE: all code is open source but i have a branch on SignalR.Orleans, and the issue is inside Signalr.Orleans, and we have a "sample" app which consumes it - if really needed i can write a small guide exactly how to setup
update:
- just another note it was being deactivated via the `DeactivateOnIdle`
- now changed with timer on activation to perform cleanup via interval and it doesnt seem to be timing out (so far)
Contributor guide
Assessment
This issue has not been assessed yet.