[common] Fix file system leaks when the Hadoop file system cache is disabled - #8962
Open
wombatu-kun wants to merge 1 commit into
Open
Conversation
2 tasks
wombatu-kun
force-pushed
the
issue/8548-hadoop-fileio-close-owned-filesystems
branch
from
July 31, 2026 12:07
62d8e28 to
28f7bf0
Compare
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.
Purpose
Closes #8548. With
fs.<scheme>.impl.disable.cache=trueeveryHadoopFileIOcreates its ownFileSystem, and nothing ever released them, so connector threads accumulate (reported withAliyunOSSFileSystem).HadoopFileIO.close()now releases the file systems it owns, mirroring Hadoop's own branch inFileSystem.get(URI, Configuration): ours only whenfs.<scheme>.impl.disable.cacheis set for the path's scheme, matched as written. Otherwise the instance lives in Hadoop's global cache, is shared JVM wide, and must not be closed here.Supporting fixes, without which that close is unreachable:
ResolvingFileIOandPluginFileIOdid not forwardclose()to their delegates, unlikeCachingFileIO. As a resultOSSFileIO.close()had never run in production.HadoopSecuredFileSystemdid not overrideclose().FileIO.checkAccessdiscarded the probeFileIOit loads to test access, leaking one file system perFileIO.get()with noclose()call involved.close()is terminal, otherwise the wrappers silently re-created their delegates and the leak returned.Out of scope: the per-module
HadoopCompliantFileIOcopies take file systems from static caches and need a separate design. Note for reviewers:RESTTokenFileIO's eviction listener already callscloseQuietly, so it now really closes file systems; the ownership gate limits that todisable.cache=true.Tests
HadoopFileIOTest(new) plus cases inResolvingFileIOTest,PluginFileIOTestandHadoopSecuredFileSystemTest: owned closed, cached untouched and still shared, ownership per scheme, failing close does not skip the rest, idempotency, creation race, use after close, no leaked access probe.paimon-common12198 tests andpaimon-corerest/catalog/fs 342 tests green on JDK 8; checkstyle and spotless clean.