[SPARK-58446][CORE] Prevent late task events from corrupting pending task state - #57651
Open
j1wonpark wants to merge 1 commit into
Open
Conversation
…task state Signed-off-by: Jiwon Park <jpark92@outlook.kr>
uros-b
approved these changes
Jul 30, 2026
Member
|
Thank you @j1wonpark! |
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 skips pending-task bookkeeping for
TaskStartandSpeculativeTaskSubmittedevents when the corresponding stage attempt has already completed.Running-task accounting remains unchanged for late
TaskStartevents so that matchingTaskEndevents are handled correctly.Regression tests were added for regular task starts, speculative task starts, and speculative task submissions after
StageCompleted.Why are the changes needed?
After
StageCompletedremoves the stage metadata, a lateTaskStartevent can recreate task-index state. Processing the matchingTaskEndcan then produce a negative pending task count.When dynamic allocation uses
minExecutors=0, this can leave the executor target at zero and prevent later stages from requesting executors.Does this PR introduce any user-facing change?
Yes. Late task events from completed stages no longer prevent subsequent stages from requesting executors when dynamic allocation is enabled.
How was this patch tested?
Added regression tests covering late regular task starts, speculative task starts, and speculative task submissions.
The three new tests failed against
upstream/masterand passed with this patch.build/sbt 'core/testOnly org.apache.spark.ExecutorAllocationManagerSuite'All 40 tests passed.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Codex (GPT-5.6)