8364503: gc/g1/TestCodeCacheUnloadDuringConcCycle.java fails because of race printing to stdout

Reviewed-by: ayang, dholmes
This commit is contained in:
Thomas Schatzl 2025-08-07 08:40:42 +00:00
parent 487cc3c5be
commit c56fb0b6ef

View File

@ -147,6 +147,7 @@ class TestCodeCacheUnloadDuringConcCycleRunner {
}
public static void main(String[] args) throws Exception {
System.out.println("Running to breakpoint: " + args[0]);
try {
WB.concurrentGCAcquireControl();
WB.concurrentGCRunTo(args[0]);
@ -157,9 +158,12 @@ class TestCodeCacheUnloadDuringConcCycleRunner {
WB.concurrentGCRunToIdle();
} finally {
// Make sure that the marker we use to find the expected log message is printed
// before we release whitebox control, i.e. before the expected garbage collection
// can start.
System.out.println(TestCodeCacheUnloadDuringConcCycle.AFTER_FIRST_CYCLE_MARKER);
WB.concurrentGCReleaseControl();
}
System.out.println(TestCodeCacheUnloadDuringConcCycle.AFTER_FIRST_CYCLE_MARKER);
Thread.sleep(1000);
triggerCodeCacheGC();
}