6545967: sp05t003 failed ResumeThread() due to THREAD_NOT_SUSPENDED

Reviewed-by: cjplummer, sspitsyn
This commit is contained in:
Gary Adams 2018-06-20 13:57:38 -04:00
parent 07012c9753
commit dfe4aabde4
2 changed files with 18 additions and 15 deletions

View File

@ -85,21 +85,24 @@ public class hs203t003 extends RedefineAgent {
// check if we can can pop the thread. // check if we can can pop the thread.
// we can not do redefine/pop frame on run method. // we can not do redefine/pop frame on run method.
while (!MyThread.resume.get()); while (!MyThread.resume.get());
Thread.sleep(10000);
// sleep for some few secs to get redefined. // sleep for some few secs to get redefined.
popThreadFrame(mt); while (!isRedefined()) {
// pop the frame. if (!agentStatus()) {
resumeThread(mt); System.out.println("Failed to redefine class");
// resume the thread. return passed;
}
Thread.sleep(100);
}
popThreadFrame(mt); // pop the frame.
resumeThread(mt); // resume the thread.
mt.join(); mt.join();
// wait till the other thread completes its execution. // wait till the other thread completes its execution.
System.out.println(" Thread state after poping / redefining = "+mt.threadState); System.out.println("Thread state after popping/redefining = "
+ mt.threadState);
} catch(Exception ie) { } catch(Exception ie) {
ie.printStackTrace(); ie.printStackTrace();
} }
if ( ( mt.threadState < 1000 ) && if ((mt.threadState < 1000) && agentStatus()) {
( redefineAttempted() && isRedefined()) &&
agentStatus() ) {
passed = true; passed = true;
} }
return passed; return passed;

View File

@ -383,7 +383,6 @@ callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
for (i = 0; i < THREADS_COUNT; i++) { for (i = 0; i < THREADS_COUNT; i++) {
if (NSK_CPP_STUB3(IsSameObject, jni, threadsList[i], thread)) { if (NSK_CPP_STUB3(IsSameObject, jni, threadsList[i], thread)) {
NSK_DISPLAY0("SUCCESS: expected THREAD_START event\n"); NSK_DISPLAY0("SUCCESS: expected THREAD_START event\n");
eventsStart++;
/* suspend thread */ /* suspend thread */
NSK_DISPLAY3(" suspend starting thread #%d (%s): %p\n", NSK_DISPLAY3(" suspend starting thread #%d (%s): %p\n",
@ -394,6 +393,7 @@ callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return; return;
} }
eventsStart++;
break; break;
} }
@ -418,7 +418,6 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
for (i = 0; i < THREADS_COUNT; i++) { for (i = 0; i < THREADS_COUNT; i++) {
if (NSK_CPP_STUB3(IsSameObject, jni, threadsList[i], thread)) { if (NSK_CPP_STUB3(IsSameObject, jni, threadsList[i], thread)) {
NSK_DISPLAY0("SUCCESS: expected THREAD_END event\n"); NSK_DISPLAY0("SUCCESS: expected THREAD_END event\n");
eventsEnd++;
/* suspend thread */ /* suspend thread */
NSK_DISPLAY3(" suspend finishing thread #%d (%s): %p\n", NSK_DISPLAY3(" suspend finishing thread #%d (%s): %p\n",
@ -429,6 +428,7 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return; return;
} }
eventsEnd++;
break; break;
} }