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

    https://github.com/apache/spark/pull/11746#discussion_r57398970
  
    --- Diff: 
core/src/main/scala/org/apache/spark/deploy/worker/DriverRunner.scala ---
    @@ -68,56 +71,67 @@ private[deploy] class DriverRunner(
     
       private var clock: Clock = new SystemClock()
       private var sleeper = new Sleeper {
    -    def sleep(seconds: Int): Unit = (0 until seconds).takeWhile(f => 
{Thread.sleep(1000); !killed})
    +    def sleep(seconds: Int): Unit = Thread.sleep(seconds * 1000)
       }
     
       /** Starts a thread to run and manage the driver. */
       private[worker] def start() = {
    -    new Thread("DriverRunner for " + driverId) {
    +    workerThread = new Thread("DriverRunner for " + driverId) {
           override def run() {
             try {
    -          val driverDir = createWorkingDirectory()
    -          val localJarFilename = downloadUserJar(driverDir)
    -
    -          def substituteVariables(argument: String): String = argument 
match {
    -            case "{{WORKER_URL}}" => workerUrl
    -            case "{{USER_JAR}}" => localJarFilename
    -            case other => other
    +          shutdownHook = ShutdownHookManager.addShutdownHook { () =>
    +            killProcessAndFinalize(DriverState.KILLED, new 
SparkException("Worker shutting down"))
    --- End diff --
    
    There is a race condition here: if this shutdown hook is running while the 
thread is starting the driver process, the shutdown hook may miss that.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to