Github user lw-lin commented on the issue: https://github.com/apache/spark/pull/13685 Hi @squito thanks for the comments! > how you'd have a TaskKilledException, but without setting the task to `killed` This can be reproduced when, a task gets killed([Executor#L235~L252](https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/executor/Executor.scala#L235~L252)) before it can be deserialized([Executor#L253](https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/executor/Executor.scala#L253)). Then in [TaskRunner.kill()](https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/executor/Executor.scala#L211), `task` is still `null`, so only `taskRunner.killed` is set to `true` but not `task.killed`. The updated test reproduces this. In the test, we use `mockExecutorBackend` to trigger `executor.killAllTasks(true)` at Executor#L240; the program should run in this order: ``` +-----------------------------+----------------------------------------------+ | main test thread | worker thread | +-----------------------------+----------------------------------------------+ | executor.launchTask() | | | | TaskRunner.run() begins | | | ... | | | execBackend.statusUpdate // 1st time, #L240 | | executor.killAllTasks(true) | | | | ... | | | task = ser.deserialize // #L253 | | | ... | | | execBackend.statusUpdate // 2nd time, #L365 | | | ... | | | TaskRunner.run() ends | | check results | | +-----------------------------+----------------------------------------------+ ``` Then: <table> <tr> <td align="center"><strong></strong></td> <td align="center"><strong>prior to this patch</strong></td> <td align="center"><strong>after this patch</strong></td> </tr> <tr> <td align="center">testFailedReason</td> <td align="center">ExceptionFailure</td> <td align="center">TaskKilled</td> </tr> <tr> <td align="center">taskState</td> <td align="center">FAILED</td> <td align="center">KILLED</td> </tr> </table>
--- 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