Uploaded image for project: 'OpenJDK'
  1. OpenJDK
  2. OPENJDK-4291

JFR path-to-gc-roots causes crash for a live long linked list.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 21.0.9 GA
    • jfr
    • None
    • False
    • Hide

      None

      Show
      None
    • False

      JFR with path-to-gc-roots=true option causes a crash when a live long linked list, e.g. a live LinkedList with size 7000, exists in the Java Heap.

      Example Java code

      import java.util.List;
      import java.util.LinkedList;
      import java.util.ArrayList;
      
      public class JFRCrashTest {
      
          private static final int TOTAL_OBJECTS = 10_000_000;
      
          private static List<List<String>> lists = new ArrayList<>();
      
          public static void main(String[] args) throws Exception {
      
              int nObjectsPerList = (args.length > 0) ? Integer.parseInt(args[0]) : 7_000;
              System.out.println("number of objects per list: " + nObjectsPerList);
      
              for (int n = 0; n < TOTAL_OBJECTS / nObjectsPerList; n++) {
                  List<String> list = new LinkedList<>();
      
                  for (int i = 0; i < nObjectsPerList; i++) {
                      list.add(new String("" + i));
                  }
                  lists.add(list);
              }
              System.out.println("done");
          }
      }
      

      Steps to reproduce

      $ unzip reproducer_jfrcrashtest_1a.zip
      $ cd reproducer_jfrcrashtest_1a
      $ ./run.sh
      /usr/lib/jvm/java-21-openjdk-21.0.9.0.10-1.el9.x86_64/bin/java
      [0.548s][info][jfr,startup] Started recording 1.
      [0.548s][info][jfr,startup] 
      [0.548s][info][jfr,startup] Use jcmd 8328 JFR.dump name=app1 filename=FILEPATH to copy recording data to file.
      number of objects per list: 7000
      done
      ./run.sh: line 16:  8793 Segmentation fault      (core dumped) java -Xms4096m -Xmx4096m -XX:StartFlightRecording=settings=default,dumponexit=true,path-to-gc-roots=true,maxage=1h,name=app1 JFRCrashTest
      

      Reproducibility

      The issue does not occur on OpenJDK 17.0.17, 25.0.1 but occurs on OpenJDK 21.0.9.

              rh-ee-tstuefe Thomas Stuefe
              rhn-support-myoshida Masato Yoshida
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: