Skip to content
Snippets Groups Projects
Commit 56a9692f authored by Marcelo Vanzin's avatar Marcelo Vanzin
Browse files

[SPARK-10987] [YARN] Workaround for missing netty rpc disconnection event.

In YARN client mode, when the AM connects to the driver, it may be the case
that the driver never needs to send a message back to the AM (i.e., no
dynamic allocation or preemption). This triggers an issue in the netty rpc
backend where no disconnection event is sent to endpoints, and the AM never
exits after the driver shuts down.

The real fix is too complicated, so this is a quick hack to unblock YARN
client mode until we can work on the real fix. It forces the driver to
send a message to the AM when the AM registers, thus establishing that
connection and enabling the disconnection event when the driver goes
away.

Also, a minor side issue: when the executor is shutting down, it needs
to send an "ack" back to the driver when using the netty rpc backend; but
that "ack" wasn't being sent because the handler was shutting down the rpc
env before returning. So added a change to delay the shutdown a little bit,
allowing the ack to be sent back.

Author: Marcelo Vanzin <vanzin@cloudera.com>

Closes #9021 from vanzin/SPARK-10987.
parent 2df882ef
No related branches found
No related tags found
No related merge requests found
......@@ -110,6 +110,11 @@ private[spark] class CoarseGrainedExecutorBackend(
case StopExecutor =>
logInfo("Driver commanded a shutdown")
// Cannot shutdown here because an ack may need to be sent back to the caller. So send
// a message to self to actually do the shutdown.
self.send(Shutdown)
case Shutdown =>
executor.stop()
stop()
rpcEnv.shutdown()
......
......@@ -100,4 +100,11 @@ private[spark] object CoarseGrainedClusterMessages {
case class KillExecutors(executorIds: Seq[String]) extends CoarseGrainedClusterMessage
// Used internally by executors to shut themselves down.
case object Shutdown extends CoarseGrainedClusterMessage
// SPARK-10987: workaround for netty RPC issue; forces a connection from the driver back
// to the AM.
case object DriverHello extends CoarseGrainedClusterMessage
}
......@@ -170,6 +170,8 @@ private[spark] abstract class YarnSchedulerBackend(
case RegisterClusterManager(am) =>
logInfo(s"ApplicationMaster registered as $am")
amEndpoint = Option(am)
// See SPARK-10987.
am.send(DriverHello)
case AddWebUIFilter(filterName, filterParams, proxyBase) =>
addWebUIFilter(filterName, filterParams, proxyBase)
......
......@@ -564,6 +564,9 @@ private[spark] class ApplicationMaster(
case x: AddWebUIFilter =>
logInfo(s"Add WebUI Filter. $x")
driver.send(x)
case DriverHello =>
// SPARK-10987: no action needed for this message.
}
override def receiveAndReply(context: RpcCallContext): PartialFunction[Any, Unit] = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment