clhsdb "dumpcodecache" command does not work

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • None
    • Affects Version/s: 27
    • Component/s: hotspot
    • None

      The clhsdb "dumpcodecache" command does not work. It properly dumps a bunch of code, but then gets stuck. It stops producing output and never exits. It seems to be stuck in an infinite loop in StubQueue.getStubAt():

        public Stub getStubContaining(Address pc) {
          if (contains(pc)) {
            for (Stub s = getFirst(); s != null; s = getNext(s)) {
              if (stubContains(s, pc)) {
                return s;
              }
            }
          }
          return null;
        }

      I added a println to print s on each iteration, and it is repeating the same 280 entries. I modified getStubContaining() to detect that it has looped backed to the first entry, and return null in that case. That seems to fix the issue, and it only turns up once during the dump. It does result in the following complaint in the output:

        Unknown location in the Interpreter: 0x00007f7a1ab6f460

      Here's a sample stack when clhsdb is stuck. Note the frames above getStubContaining() can vary:

      "main" #3 [3639569] prio=5 os_prio=0 cpu=318170.40ms elapsed=415.65s tid=0x00007f902402c400 nid=3639569 runnable [0x00007f90290d5000]
         java.lang.Thread.State: RUNNABLE
      Thread: 0x00007f902402c400 [0x378911] State: _at_safepoint _at_poll_safepoint 0
         JavaThread state: _thread_blocked
      at sun.jvm.hotspot.types.basic.BasicField.getAddress(jdk.hotspot.agent@26-internal/BasicField.java:168)
      at sun.jvm.hotspot.types.basic.BasicAddressFieldWrapper.getValue(jdk.hotspot.agent@26-internal/BasicAddressFieldWrapper.java:43)
      at sun.jvm.hotspot.code.StubQueue.getStubBuffer(jdk.hotspot.agent@26-internal/StubQueue.java:151)
      at sun.jvm.hotspot.code.StubQueue.getStubAt(jdk.hotspot.agent@26-internal/StubQueue.java:156)
      at sun.jvm.hotspot.code.StubQueue.getNext(jdk.hotspot.agent@26-internal/StubQueue.java:116)
      at sun.jvm.hotspot.code.StubQueue.getStubContaining(jdk.hotspot.agent@26-internal/StubQueue.java:90)
      at sun.jvm.hotspot.interpreter.Interpreter.getCodeletContaining(jdk.hotspot.agent@26-internal/Interpreter.java:67)
      at sun.jvm.hotspot.ui.classbrowser.HTMLGenerator.genHTML(jdk.hotspot.agent@26-internal/HTMLGenerator.java:830)
      at sun.jvm.hotspot.CommandProcessor$40$1.visit(jdk.hotspot.agent@26-internal/CommandProcessor.java:1509)
      at sun.jvm.hotspot.memory.CodeHeap.iterate(jdk.hotspot.agent@26-internal/CodeHeap.java:113)
      at sun.jvm.hotspot.code.CodeCache.iterate(jdk.hotspot.agent@26-internal/CodeCache.java:132)
      at sun.jvm.hotspot.CommandProcessor$40.doit(jdk.hotspot.agent@26-internal/CommandProcessor.java:1516)
      at sun.jvm.hotspot.CommandProcessor.executeCommand(jdk.hotspot.agent@26-internal/CommandProcessor.java:2088)
      at sun.jvm.hotspot.CommandProcessor.executeCommand(jdk.hotspot.agent@26-internal/CommandProcessor.java:2058)
      at sun.jvm.hotspot.CommandProcessor.run(jdk.hotspot.agent@26-internal/CommandProcessor.java:1929)
      at sun.jvm.hotspot.CLHSDB.run(jdk.hotspot.agent@26-internal/CLHSDB.java:113)
      at sun.jvm.hotspot.CLHSDB.main(jdk.hotspot.agent@26-internal/CLHSDB.java:45)
      at sun.jvm.hotspot.SALauncher.runCLHSDB(jdk.hotspot.agent@26-internal/SALauncher.java:285)
      at sun.jvm.hotspot.SALauncher$$Lambda/0x0000000094041800.accept(jdk.hotspot.agent@26-internal/Unknown Source)
      at sun.jvm.hotspot.SALauncher.main(jdk.hotspot.agent@26-internal/SALauncher.java:507)

            Assignee:
            Unassigned
            Reporter:
            Chris Plummer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: