rmetzger commented on a change in pull request #15108:
URL: https://github.com/apache/flink/pull/15108#discussion_r594093287



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/security/FlinkSecurityManager.java
##########
@@ -217,4 +200,19 @@ void unmonitorUserSystemExit() {
     boolean userSystemExitMonitored() {
         return Boolean.TRUE.equals(monitorUserSystemExit.get());
     }
+
+    /**
+     * Use this method to circumvent the configured {@link 
FlinkSecurityManager} behavior, ensuring
+     * that the current JVM process will always stop via System.exit() or
+     * Runtime.getRuntime().halt().
+     */
+    public static void forceProcessExit(int exitCode) {
+        // Unset ourselves to allow exiting in any case.
+        System.setSecurityManager(null);
+        if (flinkSecurityManager != null && 
flinkSecurityManager.haltOnSystemExit) {
+            Runtime.getRuntime().halt(exitCode);
+        } else {
+            System.exit(exitCode);
+        }

Review comment:
       I would consider this a follow up improvement, if somebody really needs 
this. If a user wants to use their own security manager and protect against 
this, they can forbid access to replacing the security manager, using the 
"setSecurityManager" permission.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to