Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/16189#discussion_r91673751
--- Diff: core/src/main/scala/org/apache/spark/executor/Executor.scala ---
@@ -161,12 +163,7 @@ private[spark] class Executor(
* @param interruptThread whether to interrupt the task thread
*/
def killAllTasks(interruptThread: Boolean) : Unit = {
- // kill all the running tasks
- for (taskRunner <- runningTasks.values().asScala) {
- if (taskRunner != null) {
- taskRunner.kill(interruptThread)
- }
- }
+ runningTasks.keys().asScala.foreach(t => killTask(t, interruptThread =
interruptThread))
--- End diff --
By the way, I looked at the current code and I'm actually not sure that the
back-to-back `killTask` for the same task can actually happen very easily in
the current architecture.
AFICT, the `interruptThread` flag comes from the job group properties at
the time of job submission or is hardcoded to `true` in the case where we're
killing redundant task attempts in `handleSuccessfulTask`. So, unless users are
using speculation then I don't think this case can arise, and if they are using
it then it should only crop up in a weird context where the speculative task
refuses to die and then we cancel the job.
So, in a nutshell, I think the case that we're guarding against with this
logic isn't actually that common in practice, but it's a good idea to be
resilient in case anyone ever refactors this code.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]