Skip to content

Commit

Permalink
add null checking and remove unnecessary killProce
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingCat committed Apr 24, 2014
1 parent 3107aeb commit 85767da
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ private[spark] class ExecutorRunner(
}

private def killProcess() {
logInfo("Killing process!")
process.destroy()
process.waitFor()
if (process != null) {
logInfo("Killing process!")
process.destroy()
process.waitFor()
}
}

/** Stop this executor runner, including killing the process it launched */
Expand Down Expand Up @@ -138,7 +140,6 @@ private[spark] class ExecutorRunner(
// long-lived processes only. However, in the future, we might restart the executor a few
// times on the same machine.
val exitCode = process.waitFor()
killProcess()
state = ExecutorState.FAILED
val message = "Command exited with code " + exitCode
worker ! ExecutorStateChanged(appId, execId, state, Some(message), Some(exitCode))
Expand Down

0 comments on commit 85767da

Please sign in to comment.