Skip to content

Commit

Permalink
[SPARK-35714]Bug fix for deadlock during the executor shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
wankunde committed Jun 10, 2021
1 parent 88f1d82 commit 3b38ae8
Showing 1 changed file with 13 additions and 1 deletion.
Expand Up @@ -17,8 +17,13 @@

package org.apache.spark.deploy.worker

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.concurrent.duration._

import org.apache.spark.internal.Logging
import org.apache.spark.rpc._
import org.apache.spark.util.ThreadUtils

/**
* Endpoint which connects to a worker process and terminates the JVM if the
Expand All @@ -45,7 +50,14 @@ private[spark] class WorkerWatcher(
private val expectedAddress = RpcAddress.fromURIString(workerUrl)
private def isWorker(address: RpcAddress) = expectedAddress == address

private def exitNonZero() = if (isTesting) isShutDown = true else System.exit(-1)
private def exitNonZero() =
if (isTesting) {
isShutDown = true
} else {
ThreadUtils.awaitResult(Future {
System.exit(-1)
}, 5.seconds)
}

override def receive: PartialFunction[Any, Unit] = {
case e => logWarning(s"Received unexpected message: $e")
Expand Down

0 comments on commit 3b38ae8

Please sign in to comment.