JOL is hanging when running from module path

Aleksey Shipilev shade at redhat.com
Mon Nov 13 10:26:49 UTC 2017


On 10/24/2017 06:35 AM, Zheka Kozlov wrote:
> Then I run the program with the following args:
> 
> java -p
> java9.jar;C:\Users\john_kozlov\.m2\repository\org\openjdk\jol\jol-core\0.9\jol-core-0.9.jar
> -m java9/org.example.Example
> 
> The program is hanging with no output.

Not the case on Linux, unfortunately. Or maybe I have constructed the example incorrectly? Please
consider creating the automated MCVE next time to avoid this.

> The cause of the problem is an empty classpath: ServiceabilityAgentSupport.java:279. Since the
> classpath is empty, the process is hanging infinitely (ServiceabilityAgentSupport.java:242).

If the empty classpath is the problem, this should be the fix?

$ hg diff
diff -r 03064c057dc9 jol-core/src/main/java/org/openjdk/jol/vm/sa/ServiceabilityAgentSupport.java
--- a/jol-core/src/main/java/org/openjdk/jol/vm/sa/ServiceabilityAgentSupport.java	Fri Sep 22
17:29:25 2017 +0200
+++ b/jol-core/src/main/java/org/openjdk/jol/vm/sa/ServiceabilityAgentSupport.java	Mon Nov 13
11:25:52 2017 +0100
@@ -290,8 +290,10 @@
                 throw new IllegalStateException("Unhandled style: " + style);
         }

-        args.add("-cp");
-        args.add(classPath);
+        if (!classPath.isEmpty()) {
+            args.add("-cp");
+            args.add(classPath);
+        }
         return args;
     }

Can you try it?

Thanks,
-Aleksey





More information about the jol-dev mailing list