[ 
https://issues.apache.org/jira/browse/FLINK-4414?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15424672#comment-15424672
 ] 

ASF GitHub Bot commented on FLINK-4414:
---------------------------------------

Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2381#discussion_r75140948
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcService.java
 ---
    @@ -197,11 +201,11 @@ public void stopService() {
        }
     
        @Override
    -   public String getAddress(RpcGateway selfGateway) {
    +   public String getAddress(RpcGateway gateway) {
                checkState(!stopped, "RpcService is stopped");
     
    -           if (selfGateway instanceof AkkaGateway) {
    -                   ActorRef actorRef = ((AkkaGateway) 
selfGateway).getRpcEndpoint();
    +           if (gateway instanceof AkkaGateway) {
    +                   ActorRef actorRef = ((AkkaGateway) 
gateway).getActorRef();
                        return AkkaUtils.getAkkaURL(actorSystem, actorRef);
    --- End diff --
    
    This will be problematic if you pass in a local actor ref which has been 
created by a different actor system. Because then you will return a wrong 
remote address.
    
    So for example, the following test would fail:
    ```
    @Test
        public void test() {
                LinkedBlockingQueue<Object> linkedBlockingQueue = new 
LinkedBlockingQueue<>();
                TestEndpoint testEndpoint = new 
TestEndpoint(akkaRpcService1,linkedBlockingQueue);
                testEndpoint.start();
    
                TestEndpoint testEndpoint2 = new TestEndpoint(akkaRpcService2, 
linkedBlockingQueue);
                testEndpoint2.start();
    
                assertEquals(testEndpoint2.getAddress(), 
akkaRpcService1.getAddress(testEndpoint2.getSelf()));
                assertEquals(testEndpoint.getAddress(), 
akkaRpcService2.getAddress(testEndpoint.getSelf()));
        }
    ```


> Remove restriction on RpcService.getAddress
> -------------------------------------------
>
>                 Key: FLINK-4414
>                 URL: https://issues.apache.org/jira/browse/FLINK-4414
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Distributed Coordination
>            Reporter: Wenlong Lyu
>            Assignee: Wenlong Lyu
>
> currently {{RpcService}} provide only address of the endpoint, I think rpc 
> service serve both the endpoint create on it and the remote gateway create on 
> it, so it is ok to offer the getAddress to all {{RpcGateway}} created on the 
> rpc service including the server and client.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to