HeartSaVioR commented on a change in pull request #27010: [SPARK-30313][CORE]
Ensure EndpointRef is available MasterWebUI/WorkerPage
URL: https://github.com/apache/spark/pull/27010#discussion_r361597144
##########
File path: core/src/main/scala/org/apache/spark/rpc/netty/Dispatcher.scala
##########
@@ -44,13 +45,26 @@ private[netty] class Dispatcher(nettyEnv: NettyRpcEnv,
numUsableCores: Int) exte
private val shutdownLatch = new CountDownLatch(1)
private lazy val sharedLoop = new SharedMessageLoop(nettyEnv.conf, this,
numUsableCores)
- private def getMessageLoop(name: String, endpoint: RpcEndpoint): MessageLoop
= {
- endpoint match {
- case e: IsolatedRpcEndpoint =>
- new DedicatedMessageLoop(name, e, this)
- case _ =>
- sharedLoop.register(name, endpoint)
- sharedLoop
+ private def assignToMessageLoop(
+ name: String,
+ endpoint: RpcEndpoint,
+ endpointRef: RpcEndpointRef): MessageLoop = {
+ // This must be done before assigning RpcEndpoint to MessageLoop, as
MessageLoop sets Inbox be
+ // active when registering, and endpointRef must be put into endpointRefs
before onStart is
+ // called. Refer the doc of `RpcEndpoint.self`, as well as
`NettyRpcEnv.endpointRef`.
+ endpointRefs.put(endpoint, endpointRef)
+ try {
+ endpoint match {
+ case e: IsolatedRpcEndpoint =>
+ new DedicatedMessageLoop(name, e, this)
+ case _ =>
+ sharedLoop.register(name, endpoint)
+ sharedLoop
+ }
+ } catch {
+ case NonFatal(e) =>
Review comment:
It could be various reasons as we do non-trivial operations here; but yes I
haven't met and imagine any real case. That's defensive code, but this ensures
the behavior is same when failing. (ref will not be registered in refs.)
----------------------------------------------------------------
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]