dongjoon-hyun commented on code in PR #58737:
URL: https://github.com/apache/spark/pull/58737#discussion_r4030347281
##########
core/src/main/scala/org/apache/spark/scheduler/local/LocalSchedulerBackend.scala:
##########
@@ -150,12 +174,19 @@ private[spark] class LocalSchedulerBackend(
launcherBackend.connect()
override def start(): Unit = {
+ // If a stop request already arrived (e.g. launcher KILLED before
start()), do not bring up the
+ // executor endpoint or the token/credential managers on an app that is
already stopping.
+ if (stopped) {
Review Comment:
This `stopped` guard is a check-then-act without synchronization, so it
doesn't fully close the race it describes:
1. If `onStopRequest` -> `stop(KILLED)` runs on the launcher thread right
after `start()` passes this check, `stop()` sees `localEndpoint == null` and
`userCredentialManager == None` (which isn't `@volatile`) and skips both. Then
`start()` creates the endpoint and starts the `UserCredentialManager`, leaving
the renewal thread (network I/O) running on a killed app.
2. If the kill arrives before `start()`, `start()` returns here with
`localEndpoint` still `null`. `SparkContext` construction continues, and the
first `reviveOffers()` hits an NPE on `localEndpoint.send(...)`.
Could we serialize `start()`/`stop()` (e.g., `synchronized`), or re-check
`stopped` after setup and tear down what was just created?
--
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]