Apologies for resurrecting a long-dead thread, but I am facing a similar problem when using remoting with Akka 2.3.0 with Scala 2.10.2.
I have two actor systems:
- remote-registration-service: Runs on localhost:8245, and "registers" clients
- registration-client-system-{UUID}: Runs on localhost:2252 and sends registration request to the "remote-registration-service" using Patterns.ask
I start up the remote-registration-service, and then start up the registration-client-system. The registration-client-system then uses an ActorSelection, a resolveOnce, and a Patterns.ask to send a registration request to, and receive a response from, the remote-registration-service. Here's the relevant code snippets (Java):
Future<ActorRef> registrarActorRefFuture = system.actorSelection(registrationServicePath).resolveOne(new
FiniteDuration
(QUEUE_REGISTRATION_RETRY_TIMEOUT_MS,
TimeUnit.MILLISECONDS));
final ActorRef registrarActorRef = Await.result(registrarActorRefFuture, DURATION);
Future<Object> registrationResultFuture = Patterns.ask(registrationClientActor, new RegisterMessage(clientId,
priority), DURATION.toMillis());
Object regResult = Await.result(registrationResultFuture, DURATION);
The registration process executes successfully and I receive a response back from the remote-registration-service. The registration-client-service then shuts down.
At this point, the remote-registration-service starts to print out dead letter messages as shown below. I have marked the messages from the remote-registration-service in Bold
2014-05-01 19:33:19,965 DEBUG: c.c.c.c.s.QueueRegistrationService | ...Registration complete. Starting shutdown of registration-client-system...
[INFO] [05/01/2014 19:33:19.992] [registration-client-system0c0be54e-87d8-4920-8725-019b2e8ab0f0-akka.actor.default-dispatcher-3] [akka://registration-client-system0c0be54e-87d8-4920-8725-019b2e8ab0f0/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2Fremote-registration-service%40127.0.0.1%3A8245-0/endpointWriter/endpointReader-akka.tcp%3A%2F%2Fremote-registration-service%40127.0.0.1%3A8245-0] Message [akka.remote.transport.AssociationHandle$Disassociated] from Actor[akka://registration-client-system0c0be54e-87d8-4920-8725-019b2e8ab0f0/deadLetters] to Actor[akka://registration-client-system0c0be54e-87d8-4920-8725-019b2e8ab0f0/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2Fremote-registration-service%40127.0.0.1%3A8245-0/endpointWriter/endpointReader-akka.tcp%3A%2F%2Fremote-registration-service%40127.0.0.1%3A8245-0#-1326837246] 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] [05/01/2014 19:33:19.993] [registration-client-system0c0be54e-87d8-4920-8725-019b2e8ab0f0-akka.actor.default-dispatcher-3] [akka://registration-client-system0c0be54e-87d8-4920-8725-019b2e8ab0f0/system/transports/akkaprotocolmanager.tcp1/akkaProtocol-tcp%3A%2F%2Fremote-registration-service%40127.0.0.1%3A8245-1] Message [akka.remote.transport.AssociationHandle$Disassociated] from Actor[akka://registration-client-system0c0be54e-87d8-4920-8725-019b2e8ab0f0/deadLetters] to Actor[akka://registration-client-system0c0be54e-87d8-4920-8725-019b2e8ab0f0/system/transports/akkaprotocolmanager.tcp1/akkaProtocol-tcp%3A%2F%2Fremote-registration-service%40127.0.0.1%3A8245-1#-606871149] 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] [05/01/2014 19:33:19.993] [remote-registration-service-akka.actor.default-dispatcher-2] [akka://remote-registration-service/system/transports/akkaprotocolmanager.tcp0/akkaProtocol-tcp%3A%2F%2Fremote-registration-service%40127.0.0.1%3A57446-1] Message [akka.remote.transport.AssociationHandle$Disassociated] from Actor[akka://remote-registration-service/deadLetters] to Actor[akka://remote-registration-service/system/transports/akkaprotocolmanager.tcp0/akkaProtocol-tcp%3A%2F%2Fremote-registration-service%40127.0.0.1%3A57446-1#-707785622] 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'.
Caused by: akka.remote.transport.Transport$InvalidAssociationException: The remote system terminated the association because it is shutting down.
]
[INFO] [05/01/2014 19:33:20.003] [remote-registration-service-akka.actor.default-dispatcher-3] [akka://remote-registration-service/system/transports/akkaprotocolmanager.tcp0/akkaProtocol-tcp%3A%2F%2Fremote-registration-service%40127.0.0.1%3A57446-1] Message [akka.remote.transport.ActorTransportAdapter$DisassociateUnderlying] from Actor[akka://remote-registration-service/deadLetters] to Actor[akka://remote-registration-service/system/transports/akkaprotocolmanager.tcp0/akkaProtocol-tcp%3A%2F%2Fremote-registration-service%40127.0.0.1%3A57446-1#-707785622] 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] [05/01/2014 19:33:20.011] [ForkJoinPool-5-worker-15] [Remoting] Remoting shut down
Then, I restart the registration-client-system. This time, it comes up with a different actor-system-name because the suffix UUID is different. But this time, even retrieving the actorref from the ActorSelection fails as shown in the error logs below:
2014-05-01 19:33:22,084 ERROR: c.c.c.c.s.QueueRegistrationService | FAIL!
at akka.actor.ActorSelection$$anonfun$resolveOne$1.apply(ActorSelection.scala:65) ~[akka-actor_2.10-2.3.0.jar:na]
at akka.actor.ActorSelection$$anonfun$resolveOne$1.apply(ActorSelection.scala:63) ~[akka-actor_2.10-2.3.0.jar:na]
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:29) ~[scala-library-2.10.2.jar:na]
at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.processBatch$1(BatchingExecutor.scala:67) ~[akka-actor_2.10-2.3.0.jar:na]
at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:82) ~[akka-actor_2.10-2.3.0.jar:na]
at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59) ~[akka-actor_2.10-2.3.0.jar:na]
at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59) ~[akka-actor_2.10-2.3.0.jar:na]
at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72) ~[scala-library-2.10.2.jar:na]
at akka.dispatch.BatchingExecutor$Batch.run(BatchingExecutor.scala:58) ~[akka-actor_2.10-2.3.0.jar:na]
at akka.dispatch.ExecutionContexts$sameThreadExecutionContext$.unbatchedExecute(Future.scala:74) ~[akka-actor_2.10-2.3.0.jar:na]
at akka.dispatch.BatchingExecutor$class.execute(BatchingExecutor.scala:110) ~[akka-actor_2.10-2.3.0.jar:na]
at akka.dispatch.ExecutionContexts$sameThreadExecutionContext$.execute(Future.scala:73) ~[akka-actor_2.10-2.3.0.jar:na]
at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:37) ~[scala-library-2.10.2.jar:na]
at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:133) ~[scala-library-2.10.2.jar:na]
at akka.pattern.PromiseActorRef.$bang(AskSupport.scala:267) ~[akka-actor_2.10-2.3.0.jar:na]
at akka.remote.DefaultMessageDispatcher.dispatch(Endpoint.scala:86) ~[akka-remote_2.10-2.3.0.jar:na]
at akka.remote.EndpointReader$$anonfun$receive$2.applyOrElse(Endpoint.scala:804) ~[akka-remote_2.10-2.3.0.jar:na]
at akka.actor.Actor$class.aroundReceive(Actor.scala:465) ~[akka-actor_2.10-2.3.0.jar:na]
at akka.remote.EndpointActor.aroundReceive(Endpoint.scala:408) ~[akka-remote_2.10-2.3.0.jar:na]
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516) ~[akka-actor_2.10-2.3.0.jar:na]
at akka.actor.ActorCell.invoke(ActorCell.scala:487) ~[akka-actor_2.10-2.3.0.jar:na]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238) ~[akka-actor_2.10-2.3.0.jar:na]
at akka.dispatch.Mailbox.run(Mailbox.scala:220) ~[akka-actor_2.10-2.3.0.jar:na]
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393) ~[akka-actor_2.10-2.3.0.jar:na]
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) ~[scala-library-2.10.2.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) ~[scala-library-2.10.2.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) ~[scala-library-2.10.2.jar:na]
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) ~[scala-library-2.10.2.jar:na]
At this point, the registration-client-system-{UUID} begins its shutdown process. Then, I see a very interesting error message from the remote-registration-service which seems to indicate that the remote-registration-service is aware of the registration-client-system, but is for some reason not sending any messages back to it!