Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Dead letters encountered" as soon as actors are placed into router

Tags:

scala

akka

Here's what I'm finding, and for the life of me I can't navigate to the reason. I'm creating "printer" actors that basically either do nothing, or print a message based on the type of message they receive.

class Printer extends Actor {
    def receive = {
        case m: SomeMessage => println( m.text )
        case _ =>
    }
}

I'm creating several of these actors:

val actor4 = system.actorOf(Props[Printer], "t-4")
val actor5 = system.actorOf(Props[Printer], "t-5")
val actor6 = system.actorOf(Props[Printer], "t-6")

and throwing them into a vector:

val routees2 = Vector[ActorRef](actor4, actor5, actor6)

I'm doing the above so that I can throw them into a router (and they will be under the router's control). When I run the spec up to this point I'm not having any issues. As soon as I place them in a router and run the spec I'm having problems. Here's the router:

val router = system.actorOf(Props[Printer].withRouter(
    BroadcastRouter(routees = routees2)), "router-to-transformers")

Now when I run the spec I have all sorts of dead letters...

[INFO] [09/23/2013 17:10:21.468] [spider-akka.actor.default-dispatcher-6] [akka://spider/user/router-to-transformers] Message [akka.dispatch.sysmsg.DeathWatchNotification] from Actor[akka://spider/user/router-to-transformers#-1845250548] to Actor[akka://spider/user/rout
er-to-transformers#-1845250548] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [09/23/2013 17:10:21.468] [spider-akka.actor.default-dispatcher-6] [akka://spider/user/router-to-transformers] Message [akka.dispatch.sysmsg.DeathWatchNotification] from Actor[akka://spider/user/router-to-transformers#-1845250548] to Actor[akka://spider/user/rout
er-to-transformers#-1845250548] was not delivered. [2] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [09/23/2013 17:10:21.468] [spider-akka.actor.default-dispatcher-6] [akka://spider/user/router-to-transformers] Message [akka.dispatch.sysmsg.DeathWatchNotification] from Actor[akka://spider/user/router-to-transformers#-1845250548] to Actor[akka://spider/user/rout
er-to-transformers#-1845250548] was not delivered. [3] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.

For the life of me I can't figure out what is going on here. I've added a link to a snippet of the test. The numbering, in the snippet, is weird because I've cut a bunch of different attempts that were commented out so as to not clutter the snippet. I'm focused on this dead-letters issue because I feel like when I added a more actors and actually started passing messages around, things weren't getting delivered... http://snipt.org/AhVf0

It's worth calling out that these actors are local. I've read something about actorFor being depreciated and I'm wondering if that is being used and is partly what is causing my issues? There are so many moving parts here though and not a lot of stable, COMPREHENSIVE, documentation. Any help would be greatly appreciated.

like image 657
MCP Avatar asked Sep 24 '13 00:09

MCP


2 Answers

What you are seeing here is that DeathWatchNotifications are not processed, meaning that the actor (the Router) was still watching its children when it terminated. This is not automatically a sign of trouble as documented (but we should make it clearer in the case of this particular message). In this case the only way to get rid of this message is to make sure that router and routees do not terminate "at the same time".

like image 139
Roland Kuhn Avatar answered Sep 29 '22 11:09

Roland Kuhn


I ran into the same problem with my akka project. Here is my question "Dead Letters encountered" error while running AKKA remote actors

Generally dead letter encountered occurs when there is no more worker actor to receive the message sent by master. You should make sure your worker actor is alive when your master is sending it a task or message.

like image 20
java_doctor_101 Avatar answered Sep 29 '22 12:09

java_doctor_101