Skip to content

fix: close Files.walk() stream in getOutputDirectoryPerVersion()#1071

Merged
elharo merged 1 commit into
apache:masterfrom
elharo:fix-1070-files-walk-leak
Jul 5, 2026
Merged

fix: close Files.walk() stream in getOutputDirectoryPerVersion()#1071
elharo merged 1 commit into
apache:masterfrom
elharo:fix-1070-files-walk-leak

Conversation

@elharo

@elharo elharo commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #1070

Files.walk() returns a Stream<Path> backed by a DirectoryStream handle. Without try-with-resources, the stream is only closed when garbage collected, which can cause "Too many open files" errors on multi-release projects with many versioned directories.

Wrapped the stream in a try-with-resources block to ensure prompt resource release.

Files.walk() returns a Stream that holds a DirectoryStream handle.
Without try-with-resources, the handle is not released until GC,
which can cause 'Too many open files' errors on projects with
many multi-release version directories.

Fixes apache#1070
@elharo elharo requested a review from desruisseaux July 4, 2026 21:22
@elharo elharo merged commit 8bcf2c3 into apache:master Jul 5, 2026
22 of 40 checks passed
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

@elharo Please assign appropriate label to PR according to the type of change.

@github-actions github-actions Bot added this to the 4.0.0-beta-5 milestone Jul 5, 2026
@elharo elharo added the bug Something isn't working label Jul 5, 2026
@elharo elharo deleted the fix-1070-files-walk-leak branch July 5, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unclosed Files.walk() stream in getOutputDirectoryPerVersion()

2 participants