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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
      svc
    • CPU:
      generic
    • OS:
      generic

      Description

      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`.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: