Skip to content

Commit dd1cbad

Browse files
author
Serguei Spitsyn
committedJun 10, 2021
8268285: vmTestbase/nsk/jvmti/GetThreadState/thrstat002 failed with "Wrong thread "thr1" (...) state after SuspendThread"
Reviewed-by: lmesnik, amenkov, dholmes
1 parent ece3ae3 commit dd1cbad

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed
 

‎test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadState/thrstat002.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -158,8 +158,11 @@ public void run() {
158158
}
159159
System.out.println("thrstat002a.run after blockingMonitor lock");
160160

161+
System.out.println("thrstat002a.run before runningBarrier unlock");
161162
thrstat002.runningBarrier.unlock();
162-
System.out.println("thrstat002a.run after runningBarrier unlock");
163+
164+
// Don't do println's from this point until we have exited the loop,
165+
// else we can suspend in the println in an unexpected state.
163166
int i = 0;
164167
int n = 1000;
165168
while (flag) {

‎test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadState/thrstat002/thrstat002.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -355,6 +355,7 @@ Java_nsk_jvmti_GetThreadState_thrstat002_checkStatus(JNIEnv *env, jclass cls,
355355
result = STATUS_FAILED;
356356
}
357357
}
358+
fflush(0);
358359
}
359360

360361
JNIEXPORT jint JNICALL

0 commit comments

Comments
 (0)
Please sign in to comment.