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

ShouldNotReachHere() reached by AsyncGetCallTrace after JDK-8280422

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 19
    • 19
    • hotspot
    • b12

      The observation of JDK-8280422 does not hold true for AsyncGetCallTrace.

      The enhancement JDK-8280422 assumes that "thread_from_jni_environment can never return NULL", this is not true when taking AsyncGetCallTrace into consideration.

      Profiling a debug build of the JDK running the dacapo benchmark tomcat with async-profiler, results in the following error (from the generated hs_err file):

      ```
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (../../src/hotspot/share/runtime/thread.hpp:1327), pid=1320, tid=36355
      # Error: ShouldNotReachHere()
      ```

      This is related to the beginning of AsyncGetCallTrace:
      ```
      void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) {
      JavaThread* thread;

      if (trace->env_id == NULL ||
      (thread = JavaThread::thread_from_jni_environment(trace->env_id)) == NULL ||
      thread->is_exiting()) {

      // bad env_id, thread has exited or thread is exiting
      trace->num_frames = ticks_thread_exit; // -8
      return;
      }
      ```

      Before the PR https://git.openjdk.java.net/jdk/pull/7193 related to the mentioned enhancement, this check was possible, but with the change the JVM aborts in the `thread_from_jni_environment` when `is_exiting()` is true. Therefore this check is superflous. See discussion in this PR. Please comment there as Johannes Bechberger cannot do it in JBS, yet.

            mdoerr Martin Doerr
            mdoerr Martin Doerr
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: