AmitaWhite opened a new pull request, #10440:
URL: https://github.com/apache/gravitino/pull/10440
<!--
1. Title: [#<issue>] <type>(<scope>): <subject>
Examples:
- "[#123] feat(operator): Support xxx"
- "[#233] fix: Check null before access result in xxx"
- "[MINOR] refactor: Fix typo in variable name"
- "[MINOR] docs: Fix typo in README"
- "[#255] test: Fix flaky test NameOfTheTest"
Reference: https://www.conventionalcommits.org/en/v1.0.0/
2. If the PR is unfinished, please mark this PR as draft.
-->
### 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?
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"
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]