Repository navigation
[fix][cli] Set --enable-native-access=ALL-UNNAMED for the CLI tools on Java 24+ - #26365
Merged
Merged
Conversation
…n Java 24+
bin/pulsar passes --enable-native-access=ALL-UNNAMED, but the client-side entry points do
not: bin/pulsar-admin, bin/pulsar-client and bin/pulsar-shell (all of which source
bin/pulsar-admin-common.sh), and bin/pulsar-perf.
Netty loads its native libraries (epoll, io_uring, tcnative) through
java.lang.System::loadLibrary. That is a restricted method as of Java 24, so without the
flag the JVM prints to stderr on every invocation:
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::loadLibrary has been called by
io.netty.util.internal.NativeLibraryUtil in an unnamed module
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled
Besides being noise on every CLI invocation, this breaks integration and system tests that
assert the CLI writes nothing to stderr, and the JDK will block restricted methods
outright in a future release.
The flag is gated on Java 24 or later because these scripts still support older Java
versions, where the option is not accepted, and because the warning was only introduced in
Java 24. bin/pulsar can set it unconditionally since the server requires a newer JVM.
Assisted-by: Claude Code (Opus 5)
This was referenced Aug 18, 2026
Merged
nodece
approved these changes
Aug 19, 2026
nodece
pushed a commit
to ascentstream/pulsar
that referenced
this pull request
Aug 28, 2026
…n Java 24+ (apache#26365) (cherry picked from commit 68aa11c)
Radiancebobo
pushed a commit
to Radiancebobo/pulsar
that referenced
this pull request
Oct 8, 2026
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.
Motivation
bin/pulsarpasses--enable-native-access=ALL-UNNAMED, but the client-side entry points donot:
bin/pulsar-admin,bin/pulsar-clientandbin/pulsar-shell(all of which sourcebin/pulsar-admin-common.sh), andbin/pulsar-perf.Netty loads its native libraries (epoll, io_uring, tcnative) through
java.lang.System::loadLibrary, which became a restricted method in Java 24. Without the flag,every CLI invocation that ends up loading a Netty native library prints to stderr:
Three reasons this is worth fixing:
usage that captures CLI output.
(
ContainerExecResult.assertNoStderr()). This surfaced on the networking dependency update[improve][build] Upgrade networking and infrastructure client libraries #26358, where
CI - Integration - Cli,CI - System - Functionand bothCI - System - Pulsar Connectorsjobs failed on exactly this warning.the CLI tools need this regardless.
Modifications
Added to
bin/pulsar-admin-common.sh(coveringpulsar-admin,pulsar-clientandpulsar-shell) and tobin/pulsar-perf, which duplicates the same option-building logic:The Java 24 gate is deliberate, and differs from
bin/pulsar, which sets the flagunconditionally:
-gt 8and-ge 11conditionals), and the option is not accepted on Java 8 or 11, so an ungated flag would stop
the CLI from starting there;
the versions where the flag has an effect;
bin/pulsarcan set it unconditionally because the server requires a newer JVM.Verifying this change
This change is already covered by existing tests: the CLI, Function and Connectors
integration/system suites assert that CLI invocations produce no stderr output, which is the
assertion this warning was breaking.
Verified locally:
bash -n bin/pulsar-admin-common.shandbash -n bin/pulsar-perf— both parse cleanly./gradlew quickCheck--enable-native-access=ALL-UNNAMEDDoes this pull request potentially affect one of the following parts:
The JVM options used by the bundled CLI tools change on Java 24 and later.