Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8371053

diagnostic command Thread.dump_to_file crash

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      With many virtual threads and intense GC pressure, Thread.dump_to_file crashes the VM.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      $ java Test.java


      ---------- BEGIN SOURCE ----------
      import java.io.IOException;

      class Test {
        public static void main() throws InterruptedException, IOException {
          for (var i = 0; i < 10000; i++) {
            Thread.startVirtualThread(
                () -> {
                  while (true) {
                    var unused = new byte[1024];
                    Thread.yield();
                  }
                });
          }
          while (true) {
            new ProcessBuilder(
                    System.getProperty("java.home") + "/bin/jcmd",
                    Long.toString(ProcessHandle.current().pid()),
                    "Thread.dump_to_file",
                    "-overwrite",
                    "/dev/null")
                .start()
                .waitFor();
          }
        }
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: