[SPARK-59714][CORE] Align TaskSchedulerImpl.executorDecommission locking with executorLost - #58970
Closed
dongjoon-hyun wants to merge 1 commit into
Closed
dongjoon-hyun wants to merge 1 commit into
dongjoon-hyun wants to merge 1 commit into
Conversation
…cking with `executorLost`
Member
Author
|
Could you review this code-path improvement PR (about |
peter-toth
approved these changes
Sep 22, 2026
Member
Author
|
Thank you so much, @peter-toth ! |
dongjoon-hyun
added a commit
that referenced
this pull request
Sep 22, 2026
…cking with `executorLost` ### What changes were proposed in this pull request? This PR moves `rootPool.executorDecommission(executorId)` inside the `synchronized` block that `TaskSchedulerImpl.executorDecommission()` already has, keeping `backend.reviveOffers()` outside it. ### Why are the changes needed? `rootPool.executorDecommission()` reaches `TaskSetManager.recomputeLocality()`, and `TaskSchedulerImpl` documents that "TaskSetManagers are not thread safe, so any access to one should be synchronized on this class". The sibling `executorLost()` path already follows this: it calls `rootPool.executorLost()` inside the lock and keeps only the `dagScheduler` and `backend` calls outside. This makes the two paths consistent. There is no behavior change. The only production caller, `CoarseGrainedSchedulerBackend.decommissionExecutors()`, is `withLock`, which already holds this same monitor, so the call was effectively synchronized in practice. This PR makes the method self-contained instead of relying on its caller. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Opus 5 Closes #58970 from dongjoon-hyun/SPARK-59714. Authored-by: Dongjoon Hyun <dongjoon@apache.org> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org> (cherry picked from commit 582e28b) Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun
added a commit
that referenced
this pull request
Sep 22, 2026
…cking with `executorLost` ### What changes were proposed in this pull request? This PR moves `rootPool.executorDecommission(executorId)` inside the `synchronized` block that `TaskSchedulerImpl.executorDecommission()` already has, keeping `backend.reviveOffers()` outside it. ### Why are the changes needed? `rootPool.executorDecommission()` reaches `TaskSetManager.recomputeLocality()`, and `TaskSchedulerImpl` documents that "TaskSetManagers are not thread safe, so any access to one should be synchronized on this class". The sibling `executorLost()` path already follows this: it calls `rootPool.executorLost()` inside the lock and keeps only the `dagScheduler` and `backend` calls outside. This makes the two paths consistent. There is no behavior change. The only production caller, `CoarseGrainedSchedulerBackend.decommissionExecutors()`, is `withLock`, which already holds this same monitor, so the call was effectively synchronized in practice. This PR makes the method self-contained instead of relying on its caller. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Opus 5 Closes #58970 from dongjoon-hyun/SPARK-59714. Authored-by: Dongjoon Hyun <dongjoon@apache.org> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org> (cherry picked from commit 582e28b) Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR moves
rootPool.executorDecommission(executorId)inside thesynchronizedblock thatTaskSchedulerImpl.executorDecommission()already has, keepingbackend.reviveOffers()outside it.Why are the changes needed?
rootPool.executorDecommission()reachesTaskSetManager.recomputeLocality(), andTaskSchedulerImpldocuments that "TaskSetManagers are not thread safe, so any access to one shouldbe synchronized on this class". The sibling
executorLost()path already follows this: it callsrootPool.executorLost()inside the lock and keeps only thedagSchedulerandbackendcallsoutside. This makes the two paths consistent.
There is no behavior change. The only production caller,
CoarseGrainedSchedulerBackend.decommissionExecutors(), iswithLock, which already holds thissame monitor, so the call was effectively synchronized in practice. This PR makes the method
self-contained instead of relying on its caller.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Pass the CIs.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5