HeartSaVioR commented on issue #27010: [SPARK-30313][CORE] Ensure EndpointRef 
is available MasterWebUI/WorkerPage
URL: https://github.com/apache/spark/pull/27010#issuecomment-569149531
 
 
   Thanks for referring #26059. I took a look a bit, and found actual change 
relevant to this.
   
   Below is the implementation of `registerRpcEndpoint` before #26059:
   
   ```
     def registerRpcEndpoint(name: String, endpoint: RpcEndpoint): 
NettyRpcEndpointRef = {
       val addr = RpcEndpointAddress(nettyEnv.address, name)
       val endpointRef = new NettyRpcEndpointRef(nettyEnv.conf, addr, nettyEnv)
       synchronized {
         if (stopped) {
           throw new IllegalStateException("RpcEnv has been stopped")
         }
         if (endpoints.putIfAbsent(name, new EndpointData(name, endpoint, 
endpointRef)) != null) {
           throw new IllegalArgumentException(s"There is already an RpcEndpoint 
called $name")
         }
         val data = endpoints.get(name)
         endpointRefs.put(data.endpoint, data.ref)
         receivers.offer(data)  // for the OnStart message
       }
       endpointRef
     }
   ```
   
   According to the code comment, the code ensures onStart will be called 
"after" endpointRef is set to endpointRefs. Currently all the operations are 
done in getMessageLoop so we can't ensure it.
   
   Maybe SharedMessageLoop and DedicatedMessageLoop shouldn't set Inbox be 
active by itself, and let Dispatcher initiates it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to