FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-1067: Close cached HDFS FileSystem instances by xborder · Pull Request #1141 · apache/arrow-java · GitHub

GH-1067: Close cached HDFS FileSystem instances - #1141

Open
xborder wants to merge 2 commits into
apache:mainfrom
xborder:gh-1067
Open

GH-1067: Close cached HDFS FileSystem instances#1141
xborder wants to merge 2 commits into
apache:mainfrom
xborder:gh-1067

Conversation

xborder commented May 7, 2026

Copy link
Copy Markdown
Contributor

What's Changed

  • This PR fixes JVM shutdown hangs after reading HDFS datasets through Arrow Java.
  • FileSystemDatasetFactory now tracks hdfs:// URIs used to create the factory. On close(), after releasing the native dataset factory, it best-effort closes the matching Hadoop FileSystem instances.
  • The Hadoop cleanup is done via reflection so Arrow Java does not add a production dependency on Hadoop. Non-HDFS URIs are ignored.

Closes #1067 .

This comment has been minimized.

jbonofre added this to the 20.0.0 milestone May 7, 2026
jbonofre added the bug-fix PRs that fix a big. label May 7, 2026

Copy link
Copy Markdown
Member

@xborder I fixed the CI on main. Can you please rebase?

Copy link
Copy Markdown
Member

Sorry, probably need to rebase again.

xborder commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

done @lidavidm

Comment on lines +73 to +77
try {
super.close();
} finally {
hdfsFileSystems.forEach(FileSystemDatasetFactory::closeHadoopFileSystem);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

nit: could we use AutoCloseables here?

Method closeMethod = fsClass.getMethod("close");
closeMethod.invoke(fs);
} catch (Exception e) {
// Best-effort cleanup; Hadoop may not be on classpath or FileSystem already closed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

nit: worth perhaps logging this?

Comment on lines +103 to +104
} catch (Exception e) {
// Ignore here; native factory creation reports invalid user URIs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

nit: could we catch a more specific exception class for invalid URIs?

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

Labels

bug-fix PRs that fix a big.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ARROW Java][HDFS] JVM hangs after reading HDFS files via Arrow Dataset API due to non-daemon native threads

3 participants


Back | FazBrowse Home | New Git URL