8254874: ZGC: JNIHandleBlock verification failure in stack watermark processing

Reviewed-by: tschatzl, cjplummer, sspitsyn, pliden
This commit is contained in:
Stefan Karlsson 2020-10-19 07:22:29 +00:00
parent 98a395a39e
commit 672f56695e

View File

@ -339,6 +339,10 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) {
if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* klass is used by other threads - convert to global handle */
if (!NSK_JNI_VERIFY(jni, (klass = (jclass)jni->NewGlobalRef(klass)) != NULL))
return NSK_FALSE;
/* get tested thread method 'delay' */
if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "delay", "()V")) != NULL))
return NSK_FALSE;
@ -811,6 +815,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
nsk_jvmti_setFailStatus();
NSK_TRACE(jni->DeleteGlobalRef(thread));
NSK_TRACE(jni->DeleteGlobalRef(klass));
/* resume debugee and wait for sync */
if (!nsk_jvmti_resumeSync())