[#10272] Improvement : nsure JobManager.close() always shuts down background executors when jobExecutor.close() fails#10440
Merged
justinmclean merged 2 commits intoapache:mainfrom Apr 8, 2026
Conversation
… executors when jobExecutor.close() fails This commit ensures that statusPullExecutor and cleanUpExecutor are always shut down in a finally block, even if jobExecutor.close() throws an IOException. This prevents potential background thread leaks during JobManager shutdown.
Code Coverage Report
Files
|
babumahesh
pushed a commit
to babumahesh/gravitino
that referenced
this pull request
Apr 9, 2026
…wn background executors when jobExecutor.close() fails (apache#10440) ### What changes were proposed in this pull request? This PR fixes a potential thread leak in JobManager.close(). Previously, if jobExecutor.close() threw an IOException, the method would terminate early, skipping the shutdown calls for statusPullExecutor and cleanUpExecutor. The fix wraps the jobExecutor.close() call in a try block and ensures that both background executors are shut down in the finally block. ### Why are the changes needed? To guarantee that background resources are properly cleaned up even when the main job executor fails to close, preventing resource leaks. Improvement : apache#10272 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Added a new unit test TestJobManager to simulate jobExecutor.close() failure and verify that background executors are still shut down. Ran the specific unit test: ```sh ./gradlew :core:test --tests "org.apache.gravitino.job.TestJobManager" ``` Co-authored-by: AmitaWhite <amitawhite@AmitaWhites-MacBook-Pro-13.local>
babumahesh
added a commit
to babumahesh/gravitino
that referenced
this pull request
Apr 9, 2026
…shuts down background executors when jobExecutor.close() fails (apache#10440)" This reverts commit 09d0d86.
babumahesh
added a commit
to babumahesh/gravitino
that referenced
this pull request
Apr 9, 2026
…shuts down background executors when jobExecutor.close() fails (apache#10440)" This reverts commit 09d0d86.
yuqi1129
pushed a commit
to yuqi1129/gravitino
that referenced
this pull request
Apr 15, 2026
…wn background executors when jobExecutor.close() fails (apache#10440) ### What changes were proposed in this pull request? This PR fixes a potential thread leak in JobManager.close(). Previously, if jobExecutor.close() threw an IOException, the method would terminate early, skipping the shutdown calls for statusPullExecutor and cleanUpExecutor. The fix wraps the jobExecutor.close() call in a try block and ensures that both background executors are shut down in the finally block. ### Why are the changes needed? To guarantee that background resources are properly cleaned up even when the main job executor fails to close, preventing resource leaks. Improvement : apache#10272 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Added a new unit test TestJobManager to simulate jobExecutor.close() failure and verify that background executors are still shut down. Ran the specific unit test: ```sh ./gradlew :core:test --tests "org.apache.gravitino.job.TestJobManager" ``` Co-authored-by: AmitaWhite <amitawhite@AmitaWhites-MacBook-Pro-13.local>
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 fixes a potential thread leak in JobManager.close(). Previously, if jobExecutor.close() threw an IOException, the method would terminate early, skipping the shutdown calls for statusPullExecutor and cleanUpExecutor.
The fix wraps the jobExecutor.close() call in a try block and ensures that both background executors are shut down in the finally block.
Why are the changes needed?
To guarantee that background resources are properly cleaned up even when the main job executor fails to close, preventing resource leaks.
Improvement : #10272
Does this PR introduce any user-facing change?
No
How was this patch tested?
./gradlew :core:test --tests "org.apache.gravitino.job.TestJobManager"