snuyanzin commented on code in PR #23547:
URL: https://github.com/apache/flink/pull/23547#discussion_r1372332320


##########
flink-core/pom.xml:
##########
@@ -34,7 +34,14 @@ under the License.
        <packaging>jar</packaging>
 
        <properties>
-               <surefire.module.config> <!--
+               <!--
+               Two properties below should be merged once support for jdk8 and 
jdk11 is dropped.
+               The reason of extraction into a separate property with profile 
is that
+               specifying -Djava.security.manager=allow within 
${surefire.module.config} leads to
+               hanging of surefire for jdk8 and jdk11

Review Comment:
   It seems current surefire plugin (3.0.0-M5) swallows the error, i bumped 
locally to 3.0.0-M6 and received a bit more info 
   ```
   Error occurred during initialization of VM
   java.lang.Error: Could not create SecurityManager
        at java.lang.System.initPhase3([email protected]/System.java:2078)
   Caused by: java.lang.ClassNotFoundException: allow
        at 
jdk.internal.loader.BuiltinClassLoader.loadClass([email protected]/BuiltinClassLoader.java:581)
        at 
jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass([email protected]/ClassLoaders.java:178)
        at 
java.lang.ClassLoader.loadClass([email protected]/ClassLoader.java:527)
        at java.lang.Class.forName0([email protected]/Native Method)
        at java.lang.Class.forName([email protected]/Class.java:398)
        at java.lang.System.initPhase3([email protected]/System.java:2063)
   ```
   and based on the source for _java.lang.System#initPhase3_
   ```java
   /*
        * Invoked by VM.  Phase 3 is the final system initialization:
        * 1. set security manager
        * 2. set system class loader
        * 3. set TCCL
        *
        * This method must be called after the module system initialization.
        * The security manager and system class loader may be custom class from
        * the application classpath or modulepath.
        */
       private static void initPhase3() {
           // set security manager
           String cn = System.getProperty("java.security.manager");
           if (cn != null) {
               if (cn.isEmpty() || "default".equals(cn)) {
                   System.setSecurityManager(new SecurityManager());
               } else {
                   try {
                       Class<?> c = Class.forName(cn, false, 
ClassLoader.getBuiltinAppClassLoader());
                       Constructor<?> ctor = c.getConstructor();
                       // Must be a public subclass of SecurityManager with
                       // a public no-arg constructor
                       if (!SecurityManager.class.isAssignableFrom(c) ||
                               !Modifier.isPublic(c.getModifiers()) ||
                               !Modifier.isPublic(ctor.getModifiers())) {
                           throw new Error("Could not create SecurityManager: " 
+ ctor.toString());
                       }
                       // custom security manager implementation may be in 
unnamed module
                       // or a named module but non-exported package
                       ctor.setAccessible(true);
                       SecurityManager sm = (SecurityManager) 
ctor.newInstance();
                       System.setSecurityManager(sm);
                   } catch (Exception e) {
                       throw new Error("Could not create SecurityManager", e);
                   }
               }
           }
          ...
       }
   
   ```
   if it's non empty and not `default` it tries to load it using as a classname 
which is not present in jdk8, jdk11...
   



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to