Skip to content

[SPARK 55093] Handle TaskRunner construction failures in launchTask#1

Open
ChuckLin2025 wants to merge 5 commits intomasterfrom
SPARK-55093
Open

[SPARK 55093] Handle TaskRunner construction failures in launchTask#1
ChuckLin2025 wants to merge 5 commits intomasterfrom
SPARK-55093

Conversation

@ChuckLin2025
Copy link
Copy Markdown
Owner

@ChuckLin2025 ChuckLin2025 commented Jan 20, 2026

What changes were proposed in this pull request?

  • 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

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

Zequn Lin 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
@github-actions github-actions bot added the CORE label Jan 20, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 20, 2026

⚠️ Pull Request Title Validation

This pull request title does not contain a JIRA issue ID.

Please update the title to either:

  • Include a JIRA ID: [SPARK-12345] Your description
  • Mark as minor change: [MINOR] Your description

For minor changes that don't require a JIRA ticket (e.g., typo fixes), please prefix the title with [MINOR].


This comment was automatically generated by GitHub Actions

@ChuckLin2025 ChuckLin2025 changed the title SPARK 55093 [SPARK 55093] Handle TaskRunner construction failures in launchTask Jan 20, 2026
@ChuckLin2025 ChuckLin2025 self-assigned this Jan 20, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant