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

AsyncGetCallTrace leads to failing assertion in `JavaFrameAnchor::capture_last_Java_pc`

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • None
    • hotspot
    • None
    • svc
    • generic
    • generic

      Calling AsyncGetCallTrace on the fastdebug variant crashes fairly often with the following hs_err file:

      ```
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (../../src/hotspot/cpu/x86/frame_x86.cpp:737), pid=292222, tid=292808
      # assert(_last_Java_pc == NULL) failed: already walkable
      #
      # JRE version: OpenJDK Runtime Environment (19.0) (fastdebug build 19-internal-adhoc.bechbergerlocal.openjdk)
      # Java VM: OpenJDK 64-Bit Server VM (fastdebug 19-internal-adhoc.bechbergerlocal.openjdk, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0xcc8b6a] frame::sender_for_entry_frame(RegisterMap*) const+0x15a
      #
      # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P %E" (or dumping to /home/bechberger-local/Code/private/jdk-profiling-tester/results/1649769981/asgct/openjdk-server-fastdebug/dacapo tomcat/1649770106003645452/core.292222)
      #
      # If you would like to submit a bug report, please visit:
      # https://bugreport.java.com/bugreport/crash.jsp
      ```

      The related calling code is in `frame::sender_for_entry_frame` (https://github.com/openjdk/jdk/blob/6fab8a2d6a97dbd2ffceca275716d020cb9f1eea/src/hotspot/cpu/aarch64/frame_aarch64.cpp#L358)

      ```
        if (!jfa->walkable()) {
          // Capture _last_Java_pc (if needed) and mark anchor walkable.
          jfa->capture_last_Java_pc();
        }
      ```

      The problem is with AsyncGetCallTrace using also this method to walk the stack: If the VM executed the first line of this snippet and then gets interrupted by AsyncGetCallTrace, then the anchor is set walkable and the resuming of the VM crashes subsequently due to the assertion.

      Found running https://github.com/parttimenerd/jdk-profiling-tester with `./main.py profile asgct openjdk-server-fastdebug --benchmarks "dacapo*" --interval 100us -c 100 --parallel 8`.

            jbechberger Johannes Bechberger
            jbechberger Johannes Bechberger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: