Github user gaborgsomogyi commented on the issue: https://github.com/apache/spark/pull/20888 Thank for the hints. I've taken a deeper look at the possible solutions and the suggested test. The problem is similar but not the same so I would solve it a different way. So here is my proposal. `cancelStage` sets `reasonIfKilled` in `TaskContext` normally but the executor thread will run untouched at this timestamp. The thread will be killed later triggered by `killTaskIfInterrupted` which throws `TaskKilledException`. When `isInterrupted` checked all the time when `DataFrameRangeSuite.stageToKill` will be set then the race can be avoided.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org