Skip to content

Commit eb615ba

Browse files
committed
kill the process when the error happens
1 parent 0accf2f commit eb615ba

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

core/src/main/scala/org/apache/spark/deploy/worker/ExecutorRunner.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ private[spark] class ExecutorRunner(
140140
// long-lived processes only. However, in the future, we might restart the executor a few
141141
// times on the same machine.
142142
val exitCode = process.waitFor()
143+
killProcess()
143144
state = ExecutorState.FAILED
144145
val message = "Command exited with code " + exitCode
145146
worker ! ExecutorStateChanged(appId, execId, state, Some(message), Some(exitCode))
@@ -150,9 +151,7 @@ private[spark] class ExecutorRunner(
150151
}
151152
case e: Exception => {
152153
logError("Error running executor", e)
153-
if (process != null) {
154-
process.destroy()
155-
}
154+
killProcess()
156155
state = ExecutorState.FAILED
157156
val message = e.getClass + ": " + e.getMessage
158157
worker ! ExecutorStateChanged(appId, execId, state, Some(message), None)

0 commit comments

Comments
 (0)