[Build] Allow the legacy SecurityManager for FlinkClient#submit on JDK 18+ - #4487
Open
88fantasy wants to merge 1 commit into
Open
[Build] Allow the legacy SecurityManager for FlinkClient#submit on JDK 18+#448788fantasy wants to merge 1 commit into
88fantasy wants to merge 1 commit into
Conversation
…n 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.
|
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.



What changes were proposed in this pull request
Issue Number: close #4482
Fixes every
POST /flink/app/startfailing silently on JDK 18+ withUnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release, thrown fromFlinkClient#submit()'sSystem.setSecurityManager(new ExitSecurityManager())call.Brief change log
-Djava.security.manager=allowtojvm_opts.sh, next to the existing JDK 9+/17+ compatibility flags (--add-opens ...) already there forClassLoaderUtils. This re-enables dynamically setting aSecurityManagerat runtime, which JEP 411 disabled by default starting Java 18.Verifying this change
Manually verified against a real Flink 2.2.1 standalone cluster, JDK 21 console:
POST /flink/app/startreturns HTTP 200 (accepted), but the application flips toFAILED~5s later;POST /flink/app/opt_logshowsUnsupportedOperationExceptionatSystem.setSecurityManager, invisible inlogs/error.*.logandlogs/streampark.out.UnsupportedOperationExceptionis gone; job submission proceeds pastFlinkClient#submit()'s security manager setup (submission then hits a separate, unrelated classloading issue tracked in [Bug] PipelineExecutorFactory ServiceConfigurationError when submitting a Flink job (ChildFirstClassLoader / console baseline Flink version conflict) #4483, not fixed by this PR).This is a plain JVM system property — harmless and effectively a no-op on JDK 8-17 (SecurityManager is either unaffected or already dynamically settable there), required on JDK 18+.
Does this pull request potentially affect one of the following parts
jvm_opts.sh), same category as the existing--add-opensflags