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.
#
# 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.
- duplicates
-
JDK-8359472 JVM crashes when attaching a dynamic agent before JVMTI_PHASE_LIVE
-
- Open
-