8308043: Deadlock in TestCSLocker.java due to blocking GC while allocating

Reviewed-by: stefank, ayang, tschatzl
This commit is contained in:
Erik Österlund 2023-05-17 11:47:30 +00:00
parent 1a6f9810cd
commit 285c833ffa
2 changed files with 5 additions and 4 deletions

View File

@ -40,6 +40,4 @@ serviceability/sa/TestJhsdbJstackMixed.java 8248675 linux-aarch64
serviceability/jvmti/VMObjectAlloc/VMObjectAllocTest.java 8307462 generic-all
gc/cslocker/TestCSLocker.java 8293289 generic-x64
serviceability/sa/ClhsdbInspect.java 8283578 windows-x64

View File

@ -48,10 +48,13 @@ public class TestCSLocker extends Thread
// start CS locker thread
CSLocker csLocker = new CSLocker();
csLocker.start();
// After the CSLocker thread has started, any operation such as an allocation,
// which could rely on the GC to make progress, will cause a deadlock that will
// make the test time out. That includes printing. Please don't use any such
// code until unlock() is called below.
// check timeout to success deadlocking
while(System.currentTimeMillis() < startTime + timeout) {
System.out.println("sleeping...");
while (System.currentTimeMillis() < startTime + timeout) {
sleep(1000);
}