-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Actor does not receive "Terminated" message if remoting is used and it is not monitored actor's parent #1646
Comments
I have tried your example and can verify that this occurs. |
The issue is in the RemoteActorRefProvider somewhere. Disabling the remote actorref provider and using the local provider, the system behaves as expected. |
Marking this as critical, looks like actors can not watch other actors (except for their own children) when using the remote actorref provider.. |
looks like i have the same problem with spec implementation, i've already found some bugs, but i can investigate this case |
I've managed to track the issue somewhat. public IActorRef Watch(IActorRef subject)
{
var a = (IInternalActorRef)subject;
if (!a.Equals(Self) && !WatchingContains(a))
{
MaintainAddressTerminatedSubscription(() =>
{
//the watch here is forwarded to the deadletter queue
//when the local actorref provider is used, that somehow triggers a termination message
//when using the remote actorref provider, it does not..
a.Tell(new Watch(a, Self));
_state = _state.AddWatching(a);
}, a);
}
return a;
} If I comment out the In this case, the target actor is already terminated, so the This is done when using both local and remote actorref provider. but, I suspect that there is some difference between the two, e.g. that there is a missing deadletter subscription doing something with the I'm continuing to dig through this, any pointers or ideas are welcome |
public class DeadLetterActorRef : EmptyLocalActorRef
{
private readonly EventStream _eventStream;
public DeadLetterActorRef(IActorRefProvider provider, ActorPath path, EventStream eventStream)
: base(provider, path, eventStream)
{
_eventStream = eventStream;
}
//TODO: Since this isn't overriding SendUserMessage it doesn't handle all messages as Akka JVM does
protected override void HandleDeadLetter(DeadLetter deadLetter)
{
if(!SpecialHandle(deadLetter.Message, deadLetter.Sender))
_eventStream.Publish(deadLetter);
}
protected override bool SpecialHandle(object message, IActorRef sender)
{
//deadletter handler for Watch messages on local system
var w = message as Watch;
if(w != null)
{
if(w.Watchee != this && w.Watcher != this)
{
//trigger deathwatch for already dead actors..
w.Watcher.Tell(new DeathWatchNotification(w.Watchee, existenceConfirmed: false, addressTerminated: false));
}
return true;
}
return base.SpecialHandle(message, sender);
}
} |
I found the cause for this, see #1649 |
Remote ActorRef Provider Fix for #1646
Fixed by #1649 |
Hi,
I am trying to implement Reaper of Souls pattern in Akka.NET and when remoting is enabled my Reaper actor does not receive
Terminated
message from its watchees, if, at the time it receivesWatchMe
message, watchee is already dead, but direct parent of the watchees is receiving these messages regardless of watchee's state. Here is the code to reproduce this problem (you'll need three separate c# projects)I'm receiving the following output
so
Coordinator
receivesTerminated
messages whileReaper
does not. But if I disable remoting, I'm getting the following:So in that case,
Reaper
correctly receivesTerminated
messages.From Akka docs it seems it does not matter whether actor (at the moment we call Context.Watch) is dead or not link
The text was updated successfully, but these errors were encountered: