Hello, I found a quite specific case involving Actors, Future callbacks and exceptions where self becomes deadLetters.
I have the feeling I'm using self the way it is meant to be used, as described here: http://doc.akka.io/docs/akka/2.3.11/general/jmm.html#jmm-shared-state Am I doing something wrong or is it a bug? Please see code and output below to reproduce/illustrate the issue. Thanks, Fred import akka.actor._ import scala.concurrent._ case object Done case object Greet case class Complete(p: Promise[Unit]) class Greeter extends Actor { import context.dispatcher def receive = { case Done => println("Done (system still running)!") case Complete(p) => p.success(()) case Greet => val p = Promise[Unit]() val saveMyself = self p.future onComplete { case _ => println(s"self is $self") println(s"self is expexted to be $saveMyself") // cannot use self to send a message, bug? self ! Done saveMyself ! Done } self ! Complete(p) throw new Exception("Messing with onComplete callback, self will be dead letters") } } object HelloAkkaScala extends App { val system = ActorSystem("helloakka") val greeter = system.actorOf(Props[Greeter], "greeter") greeter ! Greet } Program output : Running HelloAkkaScala self is Actor[akka://helloakka/deadLetters] [ERROR] [06/18/2015 14:25:41.510] [helloakka-akka.actor.default-dispatcher-4] [akka://helloakka/user/greeter] Messing with onComplete callback, self will be dead letters java.lang.Exception: Messing with onComplete callback, self will be dead letters at Greeter$anonfun$receive$1.applyOrElse(HelloAkkaScala.scala:27) at akka.actor.Actor$class.aroundReceive(Actor.scala:467) at Greeter.aroundReceive(HelloAkkaScala.scala:8) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516) at akka.actor.ActorCell.invoke(ActorCell.scala:487) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238) at akka.dispatch.Mailbox.run(Mailbox.scala:220) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397) at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) self is expexted to be Actor[akka://helloakka/user/greeter#990239115] Done (system still running)! [INFO] [06/18/2015 14:25:41.516] [helloakka-akka.actor.default-dispatcher-3] [akka://helloakka/deadLetters] Message [Done$] from Actor[akka://helloakka/deadLetters] to Actor[akka://helloakka/deadLetters] 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'. -- >>>>>>>>>> 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.
