StatelessWorker ignores CancellationToken due to incorrect routing of cancellation signals
- Dominant language
- C#
- Stars
- 10.9k
- Forks
- 2.1k
- Avg merge
- 14h 42m
- Merged PRs (30d)
- 354
Description
The Problem:
[StatelessWorker] grains do not correctly receive cancellation signals when a client cancels a call.
Root Cause:
StatelessWorkerGrainContext does not implement IGrainCallCancellationExtension.
As a result, Silo routes the cancellation signal as a regular message to the StatelessWorker.
The message is load-balanced to any (often idle) activation instead of the one currently processing the request.
The target activation ignores the signal because it's not the owner of the CorrelationId.
Reproduction:
A [StatelessWorker] grain awaiting Task.Delay(TimeSpan.FromSeconds(20), ct) will run to completion even if the client cancels after 2 seconds.
Question:
Is this a known limitation of StatelessWorker activations, or should StatelessWorkerGrainContext be updated to broadcast/route cancellation signals to its children?
Contributor guide
Research direction
Start by reading StatelessWorkerGrainContext and IGrainCallCancellationExtension, then trace how the cancellation signal is routed for a request identified by its CorrelationId. Reproduce the issue with a StatelessWorker grain awaiting Task.Delay with a cancellation token; done means client cancellation reaches the activation processing the request instead of being ignored by another activation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100