Skip to content

[MINOR] Fix ZipFile resource leak in ResourceUtil#11617

Merged
philo-he merged 1 commit intoapache:mainfrom
acvictor:acvictor/fixZipFileResourceLeak
Feb 19, 2026
Merged

[MINOR] Fix ZipFile resource leak in ResourceUtil#11617
philo-he merged 1 commit intoapache:mainfrom
acvictor:acvictor/fixZipFileResourceLeak

Conversation

@acvictor
Copy link
Copy Markdown
Contributor

What changes are proposed in this pull request?

This PR refactors ResourceUtil.getResourcesFromJarFile() to use try-with-resources for ZipFile, replacing the manual open/close pattern. The existing code opens a file in one try block and closes it in a separate try block at the end of the method. If any unchecked exception is thrown while iterating over the zip entries, ZipFile.close() is never called, leaking a file descriptor.

How was this patch tested?

Existing unit tests.

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions Bot added the CORE works for Gluten Core label Feb 15, 2026
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@acvictor acvictor force-pushed the acvictor/fixZipFileResourceLeak branch from 0325ad2 to 984d572 Compare February 15, 2026 14:36
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@acvictor
Copy link
Copy Markdown
Contributor Author

@philo-he can you please help review this PR? Thanks in advance!

Copy link
Copy Markdown
Member

@philo-he philo-he left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks.

@philo-he philo-he merged commit 54fa956 into apache:main Feb 19, 2026
60 checks passed
@acvictor acvictor deleted the acvictor/fixZipFileResourceLeak branch March 3, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE works for Gluten Core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants