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

Assertion failure in JvmtiAgent::load for dynamic agent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • None
    • None
    • hotspot

      It's possible to crash the JVM with an assertion failure if a dynamic agent tries to attach at the wrong time.

      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/jdk/src/hotspot/share/prims/jvmtiAgent.cpp:499), pid=7, tid=95
      # assert(JvmtiEnvBase::get_phase() == JVMTI_PHASE_LIVE) failed: not in live phase!

      invoke_Agent_OnAttach expects the current phase to be JVMTI_PHASE_LIVE, otherwise it triggers an assertion failure. There's no check before invoke_Agent_OnAttach is called, perhaps the phase should be checked earlier in the chain and the attach rejected is the phase is not JVMTI_PHASE_LIVE.

      The attached patch file makes the crash deterministic. This was observed while stress-testing Async-Profiler.

        1. hs_err_pid7.log
          67 kB
        2. patch
          0.7 kB

            fandreuzzi Francesco Andreuzzi
            fandreuzzi Francesco Andreuzzi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: