Hi Jim,

On 7 March 2014 at 06:38:47, Jim Newsham ([email protected]) wrote:


Hi Bjorn,

Thanks for your response.  It may be easier to explain by providing some code 
as an illustration.  In the following main class, I start up two actor systems 
-- system1, and system2 which will deploy actors to system1.  In test1(), I try 
to remote deploy two actors with the same path name; this fails (as expected).  
In test2(), I deploy, then stop/restart system2, then deploy again with the 
same name.  This works (as expected).  

public class Main {
  
  public static void main(String... args) throws Exception {
    test1();
    //test2();
  }

  private static void test1() throws Exception {
    Config config = ConfigFactory.parseResources(Main.class, "deploy.conf");
    Config system1Config = config.getConfig("system1").withFallback(config);
    Config system2Config = config.getConfig("system2").withFallback(config);
    ActorSystem system1 = ActorSystem.create("system1", system1Config);
    int system1Port = system1Config.getInt("akka.remote.netty.tcp.port");
    Address system1Address = new Address("akka.tcp", "system1", "127.0.0.1", 
system1Port);
    
    ActorSystem system2 = ActorSystem.create("system2", system2Config);
    system2.actorOf(TestActor.props().withDeploy(new Deploy(new 
RemoteScope(system1Address))), "test");
    system2.actorOf(TestActor.props().withDeploy(new Deploy(new 
RemoteScope(system1Address))), "test");
  }
  
  private static void test2() throws Exception {
    Config config = ConfigFactory.parseResources(Main.class, "deploy.conf");
    Config system1Config = config.getConfig("system1").withFallback(config);
    Config system2Config = config.getConfig("system2").withFallback(config);
    ActorSystem system1 = ActorSystem.create("system1", system1Config);
    int system1Port = system1Config.getInt("akka.remote.netty.tcp.port");
    Address system1Address = new Address("akka.tcp", "system1", "127.0.0.1", 
system1Port);
    
    ActorSystem system2 = ActorSystem.create("system2", system2Config);
    system2.actorOf(TestActor.props().withDeploy(new Deploy(new 
RemoteScope(system1Address))), "test");
    Thread.sleep(1000L);
    
    system2.shutdown();
    Thread.sleep(1000L);
    system2 = ActorSystem.create("system2", system2Config);
    system2.actorOf(TestActor.props().withDeploy(new Deploy(new 
RemoteScope(system1Address))), "test");
  }

}

However, when I perform essentially test2(), but as two separate processes, and 
I kill system2 before redeploying again, I find that I am able to start up 
system2 and remote deploy to system1 using the same actor path with no error.  
See System1Main and System2Main in the attached source code.  I am (1) running 
System1Main; (2) running System2Main which deploys to system1; (3) killing the 
second process; (4) running System2Main again which re-deploys to system1. The 
following log output from System1Main shows that the actor is deployed to the 
same path twice, and the first instance is never stopped:


So the thing here is that you are deploying it twice from two different actor 
systems who just happen to be have the same name/port (the first system2 and 
the second system2), but they have different UIDs and are considered different 
systems by system1. This means that the actor on system1 could be “replaced” 
with a new actor for a short period until system1 realizes that the old system2 
is dead and stops the first actor.

So does the first remote deployed actor shut down eventually, or do you not see 
that even if you wait for a while?



It would be great if you could run your test with debug logging enabled.



B/





2014-03-06 18:47:34,134 [system1-akka.actor.default-dispatcher-4] INFO  
akka.event.slf4j.Slf4jLogger - Slf4jLogger started
2014-03-06 18:47:34,173 [system1-akka.actor.default-dispatcher-4] INFO  
Remoting - Starting remoting
2014-03-06 18:47:34,314 [system1-akka.actor.default-dispatcher-4] INFO  
Remoting - Remoting started; listening on addresses 
:[akka.tcp://[email protected]:2551]
2014-03-06 18:47:34,315 [system1-akka.actor.default-dispatcher-4] INFO  
Remoting - Remoting now listens on addresses: 
[akka.tcp://[email protected]:2551]
2014-03-06 18:47:40,588 [system1-akka.actor.default-dispatcher-4] INFO  
test.akka.deploy.TestActor - [1] TestActor constructed: 
akka://system1/remote/akka.tcp/[email protected]:2552/user/test
2014-03-06 18:47:40,589 [system1-akka.actor.default-dispatcher-4] INFO  
test.akka.deploy.TestActor - [1] starting: 
akka://system1/remote/akka.tcp/[email protected]:2552/user/test
2014-03-06 18:47:44,349 [system1-akka.actor.default-dispatcher-4] INFO  
akka.actor.LocalActorRef - Message 
[akka.remote.transport.AssociationHandle$Disassociated] from 
Actor[akka://system1/deadLetters] to 
Actor[akka://system1/system/transports/akkaprotocolmanager.tcp0/akkaProtocol-tcp%3A%2F%2Fsystem1%40127.0.0.1%3A60959-1#772527695]
 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'.
2014-03-06 18:47:44,355 [system1-akka.actor.default-dispatcher-4] WARN  
akka.remote.ReliableDeliverySupervisor - Association with remote system 
[akka.tcp://[email protected]:2552] has failed, address is now gated for [5000] 
ms. Reason is: [Disassociated].
2014-03-06 18:47:44,359 [system1-akka.actor.default-dispatcher-3] INFO  
akka.actor.LocalActorRef - Message 
[akka.remote.transport.ActorTransportAdapter$DisassociateUnderlying] from 
Actor[akka://system1/deadLetters] to 
Actor[akka://system1/system/transports/akkaprotocolmanager.tcp0/akkaProtocol-tcp%3A%2F%2Fsystem1%40127.0.0.1%3A60959-1#772527695]
 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'.
2014-03-06 18:47:47,009 [system1-akka.actor.default-dispatcher-4] INFO  
test.akka.deploy.TestActor - [2] TestActor constructed: 
akka://system1/remote/akka.tcp/[email protected]:2552/user/test
2014-03-06 18:47:47,009 [system1-akka.actor.default-dispatcher-4] INFO  
test.akka.deploy.TestActor - [2] starting: 
akka://system1/remote/akka.tcp/[email protected]:2552/user/test
2014-03-06 18:47:47,923 [system1-akka.actor.default-dispatcher-4] INFO  
akka.remote.RemoteActorRefProvider$RemoteDeadLetterActorRef - Message 
[akka.remote.RemoteWatcher$HeartbeatRsp] from 
Actor[akka://system1/system/remote-watcher#-567884851] to 
Actor[akka://system1/deadLetters] 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'.
2014-03-06 18:47:48,909 [system1-akka.actor.default-dispatcher-4] INFO  
akka.remote.RemoteActorRefProvider$RemoteDeadLetterActorRef - Message 
[akka.remote.RemoteWatcher$HeartbeatRsp] from 
Actor[akka://system1/system/remote-watcher#-567884851] to 
Actor[akka://system1/deadLetters] was not delivered. [4] 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'.

Jim

--
>>>>>>>>>> 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.

-- 
Björn Antonsson
Typesafe – Reactive Apps on the JVM
twitter: @bantonsson

-- 
>>>>>>>>>>      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.

Reply via email to