[PATCH] test/jdk/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java failed in JITed code

Jie Fu fujie at loongson.cn
Thu Jan 10 14:44:06 UTC 2019


Hi all,

My name is Jie Fu, a JVM developer at Loongson working on the MIPS port 
of OpenJDK.
I hope this is the right place to discuss the issue.

test/jdk/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java 
failed with "java -Xcomp RuntimeThreadInheritanceLeak".

The failure was caused by the lost of an OopMap item for "loaderRef" 
which was optimized out by the JIT with the liveness analysis optimization.
For more details, see [1].

It seems that RuntimeThreadInheritanceLeak.java is only suitable for 
testing interpreters which is not adapted to JITs at all.
Different behaviors performed by the interpreter and JITs with the same 
test case really confused us a lot.
And I think it's worth making the test also suitable for JITs.

A tiny change can fix this issue
---------------------------------
diff -r 02e648ae46c3 
test/jdk/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java
--- 
a/test/jdk/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java 
Wed Jan 09 01:06:19 2019 +0100
+++ 
b/test/jdk/java/rmi/transport/runtimeThreadInheritanceLeak/RuntimeThreadInheritanceLeak.java 
Thu Jan 10 20:49:22 2019 +0800
@@ -106,7 +106,10 @@
               * context class loader-- by giving it a chance to pass away.
               */
              Thread.sleep(2000);
-            System.gc();
+            while (loaderRef.get() != null) {
+                System.gc();
+                Thread.sleep(100);
+            }

              System.err.println(
                  "waiting to be notified of loader being weakly 
reachable...");
---------------------------------

Could you please review it and tell me if it's OK to file a bug on JBS.
Thanks.

[1] 
https://github.com/DamonFool/MyBlog/blob/master/JVM/RuntimeThreadInheritanceLeak.md


Best Regards,
Jie




More information about the core-libs-dev mailing list