orleans: Service Fabric: wrong TaskScheduler in Notify-call using observers cross-silo
Hi!
We have 2 different silo’s who needs to communicate. We use ObserverSubscriptionManager. Subscribing to the grain in the other silo works fine, and when notifying back the request reaches the silo and the grain that is subscribed. The issue: TaskScheduler.Current == TaskScheduler.Default
, so when I try to call another grain from the method which is notified I get this:
Trying to send a message Request S127.0.0.1:33003:250097472-> #84: on a silo not from within grain and not from within system target (RuntimeContext is not set to SchedulingContext) RuntimeContext.Current=null TaskScheduler.Current=System.Threading.Tasks.ThreadPoolTaskScheduler
.
I have a colleague who uses the same pattern but isn’t using Service Fabric who doesn’t have this issue, therefore wondering if it is a Service Fabric issue.
Subscription code:
var observer = await _client.CreateObjectReference<IEventObserver>(this);
await _eventGrain.Subscribe(observer);
Notified method:
public async void OnNewEvent(string ev)
{
await Process(ev);
}
Inside Process I do GrainFactory.GetGrain
and try to call that grain, which throws the exception.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 20 (20 by maintainers)
I want to get a clearer picture of what’s happening here. Please correct my understanding:
Is the
Process(ev)
call making a grain call? Which version of Orleans are you using?