8300051: assert(JvmtiEnvBase::environments_might_exist()) failed: to enter event controller, JVM TI environments must exist

Reviewed-by: dholmes, pchilanomate
This commit is contained in:
Serguei Spitsyn 2023-07-20 22:40:18 +00:00
parent 4e8f331a80
commit 783de32b6a
2 changed files with 14 additions and 12 deletions
src/hotspot/share/prims
test/hotspot/jtreg

@ -378,17 +378,6 @@ JvmtiExport::get_jvmti_interface(JavaVM *jvm, void **penv, jint version) {
return JNI_EVERSION; // unsupported major version number
}
}
if (Continuations::enabled()) {
// Virtual threads support. There is a performance impact when VTMS transitions are enabled.
if (JvmtiEnv::get_phase() == JVMTI_PHASE_LIVE) {
if (!JvmtiVTMSTransitionDisabler::VTMS_notify_jvmti_events()) {
ThreadInVMfromNative __tiv(JavaThread::current());
JvmtiEnvBase::enable_virtual_threads_notify_jvmti();
}
} else {
JvmtiVTMSTransitionDisabler::set_VTMS_notify_jvmti_events(true);
}
}
if (JvmtiEnv::get_phase() == JVMTI_PHASE_LIVE) {
JavaThread* current_thread = JavaThread::current();
@ -399,12 +388,26 @@ JvmtiExport::get_jvmti_interface(JavaVM *jvm, void **penv, jint version) {
JvmtiEnv *jvmti_env = JvmtiEnv::create_a_jvmti(version);
*penv = jvmti_env->jvmti_external(); // actual type is jvmtiEnv* -- not to be confused with JvmtiEnv*
if (Continuations::enabled()) {
// Virtual threads support for agents loaded into running VM.
// There is a performance impact when VTMS transitions are enabled.
if (!JvmtiVTMSTransitionDisabler::VTMS_notify_jvmti_events()) {
JvmtiEnvBase::enable_virtual_threads_notify_jvmti();
}
}
return JNI_OK;
} else if (JvmtiEnv::get_phase() == JVMTI_PHASE_ONLOAD) {
// not live, no thread to transition
JvmtiEnv *jvmti_env = JvmtiEnv::create_a_jvmti(version);
*penv = jvmti_env->jvmti_external(); // actual type is jvmtiEnv* -- not to be confused with JvmtiEnv*
if (Continuations::enabled()) {
// Virtual threads support for agents loaded at startup.
// There is a performance impact when VTMS transitions are enabled.
JvmtiVTMSTransitionDisabler::set_VTMS_notify_jvmti_events(true);
}
return JNI_OK;
} else {

@ -118,7 +118,6 @@ serviceability/sa/TestRevPtrsForInvokeDynamic.java 8241235 generic-all
serviceability/jvmti/ModuleAwareAgents/ThreadStart/MAAThreadStart.java 8225354 windows-all
serviceability/jvmti/vthread/GetSetLocalTest/GetSetLocalTest.java 8286836 generic-all
serviceability/jvmti/vthread/VThreadTLSTest/VThreadTLSTest.java#id1 8300051 generic-all
serviceability/dcmd/gc/RunFinalizationTest.java 8227120 linux-all,windows-x64
serviceability/sa/ClhsdbCDSCore.java 8267433 macosx-x64