From 430dfbbc1c26b5f05f161121bf2615e422fbcf42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=AE=E4=BC=9F=E5=84=BF?= Date: Thu, 13 Aug 2026 06:56:58 +0800 Subject: [PATCH] fix(build): allow the legacy SecurityManager for FlinkClient#submit on JDK 18+ FlinkClient#submit() installs a custom ExitSecurityManager via System.setSecurityManager() before invoking the Flink CLI in-process, purely to intercept System.exit() calls the CLI makes on completion (turning them into a catchable SecurityException instead of killing the whole console JVM). JEP 411 deprecated the Security Manager in Java 17 and, starting Java 18, System.setSecurityManager() throws UnsupportedOperationException unless the java.security.manager system property is explicitly set to "allow" (or a manager class name) at JVM startup -- it can no longer be set dynamically without that flag. The console ships with a JDK 21 target, so every attempt to start a Flink application fails with: java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release at java.base/java.lang.System.setSecurityManager(System.java:431) at org.apache.streampark.flink.client.FlinkClient.submit(FlinkClient.java:63) This exception is wrapped in a CompletionException and only persisted to the t_flink_app_log table (via ApplicationLog / POST /flink/app/opt_log) -- it never reaches the console's own log files, so the application just silently flips to FAILED a few seconds after every start attempt with no visible error anywhere in logs/. Add -Djava.security.manager=allow next to the existing JDK 9+/17+ compatibility flags in jvm_opts.sh, following the same pattern as the --add-opens flags already there for ClassLoaderUtils. This is a plain system property: harmless on JDK 8-17 (ignored/already-default there), required on JDK 18+. Reproduced end to end against a real Flink 2.2.1 standalone cluster: without this flag, POST /flink/app/start is accepted (HTTP 200) but the application flips to FAILED within ~5s with the exception above recorded only in t_flink_app_log, never in logs/error.*.log or logs/streampark.out. --- .../src/main/assembly/bin/jvm_opts.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/jvm_opts.sh b/streampark-console/streampark-console-service/src/main/assembly/bin/jvm_opts.sh index 0cc621a8cd..392a7e6755 100644 --- a/streampark-console/streampark-console-service/src/main/assembly/bin/jvm_opts.sh +++ b/streampark-console/streampark-console-service/src/main/assembly/bin/jvm_opts.sh @@ -27,3 +27,9 @@ # Required for dynamic classpath (ClassLoaderUtils) on JDK 9+. Ignored on JDK 8. --add-opens java.base/jdk.internal.loader=ALL-UNNAMED --add-opens jdk.zipfs/jdk.nio.zipfs=ALL-UNNAMED + +# Required for FlinkClient#submit's ExitSecurityManager (used to intercept System.exit() +# calls made by the Flink CLI during in-process job submission) on JDK 18+, where +# System.setSecurityManager() throws UnsupportedOperationException unless explicitly +# allowed (JEP 411). Ignored on JDK 17 and earlier. +-Djava.security.manager=allow