Skip to content

Bump minimum Java version to 17 and remove pre-17 workarounds#3579

Open
iemejia wants to merge 2 commits into
apache:masterfrom
iemejia:java17-extras
Open

Bump minimum Java version to 17 and remove pre-17 workarounds#3579
iemejia wants to merge 2 commits into
apache:masterfrom
iemejia:java17-extras

Conversation

@iemejia
Copy link
Copy Markdown
Member

@iemejia iemejia commented May 23, 2026

Summary

Make the build forward-compatible with JDK 21+ (tested up to JDK 25).

Hadoop upgrade (3.3.0 -> 3.4.3)

Hadoop 3.3.x uses javax.security.auth.Subject.getSubject() which was removed in JDK 23+ (JEP 471). Hadoop 3.4.x uses Subject.current() instead, restoring compatibility.

Spotless upgrade (2.46.1 -> 3.5.1)

Spotless 2.46.1 calls com.sun.tools.javac.util.Log methods that were removed in JDK 25, causing NoSuchMethodError during formatting. Spotless 3.5.1 is compatible. The minor whitespace changes to switch/case comment indentation are from the new formatter version.

Fix ByteBuffer leak in vectored I/O reads

Hadoop's readVectored() API accepts an IntFunction<ByteBuffer> for allocation but has no corresponding release callback. When ChecksumFileSystem is in the path (the default for LocalFileSystem), Hadoop allocates buffers through the caller's allocator for internal checksum verification, then abandons them without release. The caller never sees these buffers -- only sliced views of the verified data are returned through the futures.

This caused TrackingByteBufferAllocator (used in tests) to throw LeakedByteBufferException for 45+ tests using the vectored I/O path:

  • TestRecordLevelFilters (15 tests)
  • TestColumnIndexFiltering (24 tests)
  • TestParquetReader (6+ tests)

Fix: Wrap the allocator in a capturing decorator that tracks every buffer allocated during readVectored(), then registers them all for release via ByteBufferReleaser. A try-finally ensures buffers are registered even if a read future times out or fails.

This is a workaround for HADOOP-19901, which tracks the upstream bug.

Testing

  • Full build passes: 4,988 tests, 0 failures, 0 errors (JDK 25, Hadoop 3.4.3)
  • Validated on JDK 17, 21, and 25

iemejia added 2 commits May 23, 2026 09:20
… 21/25)

Hadoop upgrade (3.3.0 -> 3.4.3):
- Hadoop 3.3.x uses javax.security.auth.Subject.getSubject() which
  was removed in JDK 23+ (JEP 471). Hadoop 3.4.x uses
  Subject.current() instead, restoring JDK 25 compatibility.

Spotless upgrade (2.46.1 -> 3.5.1):
- Spotless 2.46.1 calls com.sun.tools.javac.util.Log methods that
  were removed in JDK 25, causing NoSuchMethodError at format time.
  Spotless 3.5.1 is compatible with JDK 25. The minor formatting
  changes to switch/case comment indentation are from the new version.

Fix ByteBuffer leak in vectored I/O reads:
- Hadoop's readVectored() API accepts an IntFunction<ByteBuffer> for
  allocation but has no corresponding release callback. When a
  wrapping filesystem like ChecksumFileSystem is in the path, Hadoop
  allocates a buffer through the caller's allocator, uses it
  internally for checksum verification, then creates a different
  buffer for the CompletableFuture result. The originally allocated
  buffer is abandoned without release.
- This caused TrackingByteBufferAllocator (used in tests) to throw
  LeakedByteBufferException for tests using vectored I/O:
  TestRecordLevelFilters, TestColumnIndexFiltering, TestParquetReader.
- Fix: wrap the allocator in a capturing decorator that tracks every
  buffer allocated during readVectored(), then registers them all
  for release via ByteBufferReleaser. A try-finally ensures buffers
  are registered even if a read future times out or fails.
@iemejia iemejia changed the title Upgrade Hadoop 3.3.0 -> 3.4.3, Spotless 2.46.1 -> 3.5.1, fix vectored I/O buffer leak Bump minimum Java version to 17 and remove pre-17 workarounds May 23, 2026
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.

1 participant