[SPARK 55093] Handle TaskRunner construction failures in launchTask#1
Open
ChuckLin2025 wants to merge 5 commits intomasterfrom
Open
[SPARK 55093] Handle TaskRunner construction failures in launchTask#1ChuckLin2025 wants to merge 5 commits intomasterfrom
ChuckLin2025 wants to merge 5 commits intomasterfrom
Conversation
added 2 commits
January 20, 2026 04:01
…on failure - Move createTaskRunner into try-catch block to handle construction failures - Add cleanup to remove TaskRunner from runningTasks if threadPool.execute throws - Prevent potential memory leak by cleaning up TaskRunner when threadPool.execute fails - Update test to use current TaskDescription API
- Use reflection to mock runningTasks.put to throw exception - Tests cleanup logic when TaskRunner is created but fails to be added to runningTasks - Verify exception is properly caught and reported to driver
|
…ng mocked Executor fields The test was failing because mocked Executor's val fields (runningTasks, threadPool, conf, env, killMarks) were not initialized when using mock[Executor](CALLS_REAL_METHODS). This caused NullPointerExceptions when the real launchTask method tried to access them. Solution: Use reflection to manually set these val fields on the mocked Executor object after creation, allowing the real launchTask method to execute properly and add tasks to the runningTasks map. Test now passes consistently in ~1.4 seconds.
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?
Prevent potential memory leak by cleaning up TaskRunner when threadPool.execute fails
Why are the changes needed?
The createTaskRunner may throw an Exception.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Added an unit test.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: claude-4.5