Skip to content

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

Open
elharo wants to merge 1 commit into
apache:masterfrom
elharo:fix-1070-files-walk-leak
Open

fix: close Files.walk() stream in getOutputDirectoryPerVersion()#1071
elharo wants to merge 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unclosed Files.walk() stream in getOutputDirectoryPerVersion()

1 participant