This sounds like a bug to me, but I'll leave it to the Akka team to weigh in on :-) On Apr 9, 2014 9:11 PM, "Iain Hull" <[email protected]> wrote:
> Hi Martynas, > > Thank you for you fix. This does indeed fix my case and I am very happy > change me code accordingly. > > However can you expand on the semantics of watch? Is it only safe to call > watch from the same actor that calls stop? Or is it only safe to recreate > a dead actor if the watch was called from the same actor as stop? > > The documentation says > > It should be noted that the Terminated message is generated independent >> of the order in which registration and termination occur. In particular, >> the watching actor will receive a Terminated message even if the watched >> actor has already been terminated at the time of registration. >> > > In my case when the watch and the stop are performed by different actors > the Terminated message is sent as expected, however it is not safe to > recreated the terminated actor in response to this message. Am I missing > something regarding when these affects are visible or should be this > behavior be documented? > > Iain. > > On Wednesday, 9 April 2014 15:04:32 UTC+1, Martynas Mickevičius wrote: >> >> Hi Iain, >> >> I think the problem could be in your code here: >> >> deathReporter ! DeathReportActor.Watch(fated, self, Create(value)) >> context.system.stop(fated) >> >> Here I can see a race condition. In some cases *fated* actor can be >> stopped before *Watch* message in handled. So *DeathReportActor* never >> gets *Terminated* message. If I move >> >> context.system.stop(fated) >> >> to *DeathReportActor* after *watch* call >> >> context.watch(fated) >> context.system.stop(fated) >> >> then your test case passes. >> >> -- >> Martynas Mickevičius >> Typesafe <http://typesafe.com/> – >> Reactive<http://www.reactivemanifesto.org/> Apps >> on the JVM >> > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ > >>>>>>>>>> Check the FAQ: > http://doc.akka.io/docs/akka/current/additional/faq.html > >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user > --- > You received this message because you are subscribed to the Google Groups > "Akka User List" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
