[8u60] RFR (XS): 8076325: java hangs with -XX:ParallelGCThreads=0 -XX:+ExplicitGCInvokesConcurrent options

Sangheon Kim sangheon.kim at oracle.com
Wed Apr 8 23:07:49 UTC 2015


Hi all,

I am sending this RFR again to open mailing alias.

Please review this change to remove hang with "-XX:ParallelGCThreads=0".

Java hangs with "-XX:+UseG1GC -XX:ParallelGCThreads=0 
-XX:+ExplicitGCInvokesConcurrent" combinations of options. If use 
-XX:-ExplicitGCInvokesConcurrent or -XX:ParallelGCThreads=1 then all 
works fine.
To check this issue compile and run below application[1] using this 
command "java -XX:+UseG1GC -XX:ParallelGCThreads=0 
-XX:+ExplicitGCInvokesConcurrent TestApp"

This is a regression resulted by recent backport from jdk9. But as jdk9 
disallows "ParallelGCThreads=0", this test is okay with jdk9.
In addition, backport of disallowing "ParallGCThreads=0" is not an 
option as it will change the behavior.

The hang is happening at 
"G1RootProcessor::wait_until_all_strong_classes_discovered()" since we 
can't escape from while loop of "while 
((uint)_n_workers_discovered_strong_classes != n_workers)".

This change makes to run a logic of 
"G1RootProcessor::wait_until_all_strong_classes_discovered()" and 
"G1RootProcessor::worker_has_discovered_all_strong_classes()", if gc 
workers are larger than 0.
And this change is same as the original code before change of backport.

I will need a sponsor for this change.

CR:
https://bugs.openjdk.java.net/browse/JDK-8076325

Webrev:
http://cr.openjdk.java.net/~sangheki/8076325/webrev.00/

Test:
JPRT

[1]: TestApp.java:
import java.util.*;

public class Test8000311 {
   public static void main(String args[]) {
     for(int i = 0; i<100; i++) {
       byte[] garbage = new byte[1000];
       System.gc();
       System.out.println(i);
     }
     System.out.println("PASS");
   }
}

Thanks,
Sangheon


More information about the hotspot-gc-dev mailing list