RemoteActorRef.stop raceproblem
There are multiple problems:
1) The RemoteActorRef._status is not something that reflect the state of the LocalActorRef.. so it could be that somebody already shut down the actor after the RemoteActorRef has been started. So the RemoteActorRef is still thinking that it is started, even though it is shutdown. So the simple solution (perhaps not the best performing) is to ask the state of the local actor ref and send it back to the remote actor ref.
2) A lock is acquired on the RemoteActorRef monitor, but that is not the same monitor than that of the LocalActorRef. So if there is 1 actor accessed on 3 different nodes, then there are 4 monitors. So syncing on the monitor of the RemoteActorRef is kind of useless.
def stop() {
synchronized {
if (_status == ActorRefInternals.RUNNING) {
_status = ActorRefInternals.SHUTDOWN
postMessageToMailbox(RemoteActorSystemMessage.Stop, None)
}
}
}
1) The RemoteActorRef._status is not something that reflect the state of the LocalActorRef.. so it could be that somebody already shut down the actor after the RemoteActorRef has been started. So the RemoteActorRef is still thinking that it is started, even though it is shutdown. So the simple solution (perhaps not the best performing) is to ask the state of the local actor ref and send it back to the remote actor ref.
2) A lock is acquired on the RemoteActorRef monitor, but that is not the same monitor than that of the LocalActorRef. So if there is 1 actor accessed on 3 different nodes, then there are 4 monitors. So syncing on the monitor of the RemoteActorRef is kind of useless.
def stop() {
synchronized {
if (_status == ActorRefInternals.RUNNING) {
_status = ActorRefInternals.SHUTDOWN
postMessageToMailbox(RemoteActorSystemMessage.Stop, None)
}
}
}
Leave a comment
on 2011-07-01 15:58 *
By viktorklang
Or another alternative: We remove the option to observe the state of the actor through isShutdown, isStarted etc and use lifecycle monitors for that instead.
on 2011-07-09 10:25 *
By viktorklang
Assigned to set to viktorklang
Status changed from New to Duplicate
Will be fixed using the lifecycle monitoring that is scheduled for 2.0