apache/flink · error · IllegalConfigurationException
Could not register security manager due to no permission to
Error message
Could not register security manager due to no permission to set a SecurityManager. Either update your existing SecurityManager to allow the permission or do not use security manager features (e.g., '%s: %s', '%s: %s')
What it means
FlinkSecurityManager.setFromConfiguration installs a JVM-wide SecurityManager (used to intercept System.exit and halt-on-fatal-error behavior). If System.setSecurityManager throws — most commonly because the runtime or an already-installed manager forbids it — Flink wraps it in IllegalConfigurationException, suggesting either allowing the permission or disabling the features (config keys printed in the message, cluster.intercept-user-system-exit / cluster.halt-on-fatal-error).
Source
Thrown at flink-core/src/main/java/org/apache/flink/core/security/FlinkSecurityManager.java:113
return null;
}
LOG.info(
"FlinkSecurityManager is created with {} user system exit mode and {} exit",
userSystemExitMode,
haltOnSystemExit ? "forceful" : "graceful");
// Add more configuration parameters that need user security manager (currently only for
// system exit).
return new FlinkSecurityManager(userSystemExitMode, haltOnSystemExit);
}
public static void setFromConfiguration(Configuration configuration) {
final FlinkSecurityManager flinkSecurityManager =
FlinkSecurityManager.fromConfiguration(configuration);
if (flinkSecurityManager != null) {
try {
System.setSecurityManager(flinkSecurityManager);
} catch (Exception e) {
throw new IllegalConfigurationException(
String.format(
"Could not register security manager due to no permission to "
+ "set a SecurityManager. Either update your existing "
+ "SecurityManager to allow the permission or do not use "
+ "security manager features (e.g., '%s: %s', '%s: %s')",
ClusterOptions.INTERCEPT_USER_SYSTEM_EXIT.key(),
ClusterOptions.INTERCEPT_USER_SYSTEM_EXIT.defaultValue(),
ClusterOptions.HALT_ON_FATAL_ERROR.key(),
ClusterOptions.HALT_ON_FATAL_ERROR.defaultValue()),
e);
}
}
FlinkSecurityManager.flinkSecurityManager = flinkSecurityManager;
}
public static void monitorUserSystemExitForCurrentThread() {
if (flinkSecurityManager != null) {
flinkSecurityManager.monitorUserSystemExit();View on GitHub (pinned to 2f3c205e92)
Solutions
- On JDK 17+, add -Djava.security.manager=allow to env.java.opts.all (JAVA_OPTS) in flink-conf.yaml.
- If you do not need system-exit interception, disable the features: set cluster.intercept-user-system-exit: DISABLED so Flink does not install its SecurityManager.
- If an external SecurityManager is present, grant it the setSecurityManager permission via the JVM policy file instead of working around it.
- Long term, plan to run without SecurityManager features — they are deprecated for removal in the JDK.
Example fix
# before (flink-conf.yaml, Java 17+) cluster.intercept-user-system-exit: TASK_EXECUTORS # IllegalConfigurationException at startup # after env.java.opts.all: "-Djava.security.manager=allow" # or: cluster.intercept-user-system-exit: DISABLED
Defensive patterns
Strategy: fallback
Validate before calling
// before starting Flink on JDK 17+, ensure the JVM will allow it: // env.java.opts.all: -Djava.security.manager=allow // or avoid installing the manager entirely: // cluster.intercept-user-system-exit: DISABLED
Try / catch
try {
FlinkSecurityManager.setFromConfiguration(conf);
} catch (IllegalConfigurationException e) {
// do not swallow at startup: fix JVM flags or disable intercept options, then restart
throw e;
} Prevention
- On Java 17+ always set -Djava.security.manager=allow when using security-manager features.
- Track JDK deprecation of SecurityManager; prefer the DISABLED modes for exit interception where possible.
- When running under a foreign SecurityManager, ensure its policy grants setSecurityManager.
When it happens
Trigger: Starting on JDK 17+ where installing a SecurityManager is disallowed by default (System.setSecurityManager throws UnsupportedOperationException unless -Djava.security.manager=allow); or running under an existing SecurityManager whose policy denies setSecurityManager permission.
Common situations: Migrating a Flink deployment from Java 8/11 to Java 17/21 without adding -Djava.security.manager=allow to env.java.opts.all; running Flink inside a restricted container/launcher that installs its own SecurityManager; future JDKs removing SecurityManager support entirely.
Related errors
- Could not parse value for key '%s'.
- Given configuration directory is null, cannot load configura
- The given configuration directory name '{}' ({}) does not de
- The Flink config file '{}' ({}) does not exist.
- Error parsing YAML configuration.
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/e299e9fd35127a99.
Report an issue: GitHub.