Skip to content

Commit 96057c1

Browse files
Amos ShiGoeLin
Amos Shi
authored andcommitted
8308043: Deadlock in TestCSLocker.java due to blocking GC while allocating
Reviewed-by: mbaesken Backport-of: 285c833ffacdaabe7c4955cbbafb3bc459d26784
1 parent a6fc00a commit 96057c1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/hotspot/jtreg/gc/cslocker/TestCSLocker.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ public static void main(String args[]) throws Exception {
4646
// start CS locker thread
4747
CSLocker csLocker = new CSLocker();
4848
csLocker.start();
49+
// After the CSLocker thread has started, any operation such as an allocation,
50+
// which could rely on the GC to make progress, will cause a deadlock that will
51+
// make the test time out. That includes printing. Please don't use any such
52+
// code until unlock() is called below.
4953

5054
// check timeout to success deadlocking
51-
while(System.currentTimeMillis() < startTime + timeout) {
52-
System.out.println("sleeping...");
55+
while (System.currentTimeMillis() < startTime + timeout) {
5356
sleep(1000);
5457
}
5558

0 commit comments

Comments
 (0)