dongjoon-hyun opened a new pull request, #59707:
URL: https://github.com/apache/spark/pull/59707
### What changes were proposed in this pull request?
This PR aims to fix `ThreadUtils.shutdown` to call `shutdownNow()` when the
executor does not terminate within the grace period or when the calling thread
is interrupted while waiting.
### Why are the changes needed?
Currently, `shutdownNow()` is never called because `isShutdown` is always
`true` after `shutdown()`.
```scala
executor.shutdown()
executor.awaitTermination(gracePeriod.toMillis, TimeUnit.MILLISECONDS)
if (!executor.isShutdown) { // Always false after `shutdown()`
executor.shutdownNow()
}
```
This became a regression in Apache Spark 4.0.0 because SPARK-46929 replaced
the `shutdownNow()` logic of `JobScheduler`, `CheckpointWriter`, and
`ElementTrackingStore` with `ThreadUtils.shutdown`.
### Does this PR introduce _any_ user-facing change?
Yes, but only for executors that do not terminate within the grace period.
Their running tasks are interrupted and their queued tasks are dropped, which
restores the Apache Spark 3.5 behavior of the above call sites.
### How was this patch tested?
Pass the CIs with the newly added test cases.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5.5
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]