You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2026/08/19 13:47:06 UTC

(pulsar) branch branch-4.0 updated: [fix][cli] Set --enable-native-access=ALL-UNNAMED for the CLI tools on Java 24+ (#26365)

This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 3aedfd5da647 [fix][cli] Set --enable-native-access=ALL-UNNAMED for the CLI tools on Java 24+ (#26365)
3aedfd5da647 is described below

commit 3aedfd5da64781bad52d2775ea5f689ff3396ec7
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Wed Aug 19 11:35:45 2026 +0300

    [fix][cli] Set --enable-native-access=ALL-UNNAMED for the CLI tools on Java 24+ (#26365)
    
    (cherry picked from commit 68aa11c2a46eb846feea1584c35ab38f0d1669db)
---
 bin/pulsar-admin-common.sh | 8 ++++++++
 bin/pulsar-perf            | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/bin/pulsar-admin-common.sh b/bin/pulsar-admin-common.sh
index 366d76d7f5b9..ca341b3b5fc4 100755
--- a/bin/pulsar-admin-common.sh
+++ b/bin/pulsar-admin-common.sh
@@ -127,6 +127,14 @@ if [[ $JAVA_MAJOR_VERSION -ge 11 ]]; then
   OPTS="$OPTS --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED"
 fi
 
+if [[ $JAVA_MAJOR_VERSION -ge 24 ]]; then
+  # Netty loads native libraries (epoll, io_uring, tcnative) via java.lang.System::loadLibrary,
+  # which is a restricted method from Java 24 onwards. Without this the JVM prints a warning to
+  # stderr on every invocation, and restricted methods will be blocked outright in a future
+  # release. bin/pulsar already sets this for the server side.
+  OPTS="$OPTS --enable-native-access=ALL-UNNAMED"
+fi
+
 OPTS="-cp $PULSAR_CLASSPATH $OPTS"
 
 OPTS="$OPTS $PULSAR_EXTRA_OPTS"
diff --git a/bin/pulsar-perf b/bin/pulsar-perf
index 2b120cc2f94a..0c61aa9de503 100755
--- a/bin/pulsar-perf
+++ b/bin/pulsar-perf
@@ -124,6 +124,14 @@ if [[ $JAVA_MAJOR_VERSION -ge 11 ]]; then
   OPTS="$OPTS --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED"
 fi
 
+if [[ $JAVA_MAJOR_VERSION -ge 24 ]]; then
+  # Netty loads native libraries (epoll, io_uring, tcnative) via java.lang.System::loadLibrary,
+  # which is a restricted method from Java 24 onwards. Without this the JVM prints a warning to
+  # stderr on every invocation, and restricted methods will be blocked outright in a future
+  # release. bin/pulsar already sets this for the server side.
+  OPTS="$OPTS --enable-native-access=ALL-UNNAMED"
+fi
+
 OPTS="-cp $PULSAR_CLASSPATH $OPTS"
 OPTS="$OPTS $PULSAR_EXTRA_OPTS"