Skip to content

[SPARK-56955][CORE] Add --sun-misc-unsafe-memory-access=allow for JDK 25+#55999

Closed
yadavay-amzn wants to merge 1 commit into
apache:masterfrom
yadavay-amzn:fix/SPARK-56448-skip-jdk25
Closed

[SPARK-56955][CORE] Add --sun-misc-unsafe-memory-access=allow for JDK 25+#55999
yadavay-amzn wants to merge 1 commit into
apache:masterfrom
yadavay-amzn:fix/SPARK-56448-skip-jdk25

Conversation

@yadavay-amzn
Copy link
Copy Markdown
Contributor

@yadavay-amzn yadavay-amzn commented May 19, 2026

What changes were proposed in this pull request?

Add --sun-misc-unsafe-memory-access=allow to JVM options when running on JDK 25+, in JavaModuleOptions.java.

Why are the changes needed?

JDK 25 restricts unsafe memory access by default, breaking Arrow/Netty memory allocator initialization (EmptyByteBuf.memoryAddress() throws UnsupportedOperationException). This affects spark-shell --remote and any code path that initializes Arrow.

Found by @dongjoon-hyun, confirmed by @attilapiros who identified the fix flag. Same issue as apache/iceberg#15930.

Does this PR introduce any user-facing change?

No. Spark will work correctly on JDK 25 without requiring users to manually add JVM flags.

How was this patch tested?

  • AmmoniteReplE2ESuite passes on JDK 17 (unchanged behavior)
  • AmmoniteReplE2ESuite passes on JDK 25 (was failing without the flag)

Was this patch authored or co-authored using generative AI tooling?

No.

… 25+

JDK 25 restricts unsafe memory access by default, breaking Arrow/Netty
memory allocator initialization (EmptyByteBuf.memoryAddress() throws
UnsupportedOperationException). Add the JVM flag to restore access
when running on JDK 25+.

Closes #SPARK-56955
@yadavay-amzn yadavay-amzn force-pushed the fix/SPARK-56448-skip-jdk25 branch from ec3e225 to 00823f6 Compare May 20, 2026 01:53
@yadavay-amzn yadavay-amzn changed the title [SPARK-56448][CONNECT][TESTS] Skip AmmoniteReplE2ESuite on JDK 25+ [SPARK-56955][CORE] Add --sun-misc-unsafe-memory-access=allow for JDK 25+ May 20, 2026
@yadavay-amzn
Copy link
Copy Markdown
Contributor Author

Closing in favor of #56006 by @attilapiros. Thanks!

@dongjoon-hyun
Copy link
Copy Markdown
Member

Thank you for making a PR and closing to merge with other PRs, @yadavay-amzn .

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.

2 participants