8264605: vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/TestDescription.java failed with "agent_tools.cpp, 471: (foundThread = (jthread) jni_env->NewGlobalRef(foundThread)) != NULL"

Reviewed-by: sspitsyn, dholmes
This commit is contained in:
Leonid Mesnik 2021-11-24 20:11:18 +00:00
parent 077b2de088
commit 96fe1d0d4d
2 changed files with 12 additions and 22 deletions

View File

@ -159,7 +159,6 @@ vmTestbase/nsk/jvmti/AttachOnDemand/attach045/TestDescription.java 8202971 gener
vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/TestDescription.java 8219652 aix-ppc64
vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/TestDescription.java 8219652 aix-ppc64
vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/TestDescription.java 8219652 aix-ppc64
vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/TestDescription.java 8264605 generic-all
vmTestbase/gc/lock/jni/jnilock002/TestDescription.java 8192647 generic-all

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -138,34 +138,25 @@ jvmtiEnv* nsk_jvmti_getAgentJVMTIEnv() {
return jvmti_env;
}
/* ============================================================================= */
static void set_agent_thread_state(thread_state_t value) {
rawMonitorEnter(jvmti_env, agent_data.monitor);
agent_data.thread_state = value;
rawMonitorNotify(jvmti_env, agent_data.monitor);
rawMonitorExit(jvmti_env, agent_data.monitor);
}
/** Wrapper for user agent thread. */
static void JNICALL
agentThreadWrapper(jvmtiEnv* jvmti_env, JNIEnv* agentJNI, void* arg) {
jni_env = agentJNI;
/* run user agent proc */
{
set_agent_thread_state(RUNNABLE);
rawMonitorEnter(jvmti_env, agent_data.monitor);
agent_data.thread_state = RUNNABLE;
rawMonitorNotify(jvmti_env, agent_data.monitor);
rawMonitorExit(jvmti_env, agent_data.monitor);
NSK_TRACE((*agentThreadProc)(jvmti_env, agentJNI, agentThreadArg));
NSK_TRACE((*agentThreadProc)(jvmti_env, agentJNI, agentThreadArg));
set_agent_thread_state(TERMINATED);
}
rawMonitorEnter(jvmti_env, agent_data.monitor);
agent_data.thread_state = TERMINATED;
agentJNI->DeleteGlobalRef(agentThread);
agentThread = NULL;
rawMonitorNotify(jvmti_env, agent_data.monitor);
rawMonitorExit(jvmti_env, agent_data.monitor);
/* finalize agent thread */
{
/* gelete global ref for agent thread */
agentJNI->DeleteGlobalRef(agentThread);
agentThread = NULL;
}
}
/** Start wrapper for user agent thread. */