probe does not get Terminated message

68 views
Skip to first unread message

Aditya Prasad

unread,
Sep 16, 2016, 2:02:12 AM9/16/16
to Akka User List
Howdy y'all,

I'm using a TestKit probe. It receives most messages just fine. But somehow it's not noticing the termination of my actor:

probe.watch(repActor)
probe.expectTerminated(repActor, eventTimeout.plus(100.milliseconds))

I get:
 
[info]   java.lang.AssertionError: assertion failed: expected: Terminated Actor[akka://ReplicatorSpec/user/$a#-968221567] but got unexpected message Foo(0)
[info]   at scala.Predef$.assert(Predef.scala:170)
[info]   at akka.testkit.TestKitBase$class.expectMsgPF(TestKit.scala:369)
... 

Through logging, I can confirm that (a) the actor did die, and (b) the Foo(0) message is the first thing the actor sends after it restarts (and that's the only time it is sent).

I'm guessing there's something funky about my setup, but I'm not sure where to start digging. I was thinking using OneInstancePerTest might be helpful (as seen in another bug report) but that causes its own problems.

Roland Kuhn

unread,
Sep 16, 2016, 2:24:01 AM9/16/16
to akka-user
Hi Aditya,

Terminated is only sent upon termination, not for a restart: an ActorRef stays valid across a restart so it would be wrong to signal that it becomes invalid (which is what Terminated means).

Regards,

Roland

--
>>>>>>>>>> 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 akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Aditya Prasad

unread,
Sep 16, 2016, 5:13:21 PM9/16/16
to Akka User List
D'oh, thanks! I went back and re-read the docs and now see that there's no (easy) way to be notified on an Actor stop/restart. I'll roll my own technique.

Follow-up question: why might it be that my supervisionStrategy is not being used?

override def supervisorStrategy = {
log.error("invoked") // Never called
SupervisorStrategy.stoppingStrategy
}

Aditya Prasad

unread,
Sep 16, 2016, 8:50:48 PM9/16/16
to Akka User List
Never mind. Somehow it started working.
Reply all
Reply to author
Forward
0 new messages