8336148: Test runtime/locking/TestRecursiveMonitorChurn.java failed: Unexpected Inflation

Reviewed-by: dholmes, eosterlund
This commit is contained in:
Axel Boldt-Christmas 2024-08-13 13:13:14 +00:00
parent ff8a9f9267
commit 76e33b6c15

View File

@ -70,6 +70,18 @@ public class TestRecursiveMonitorChurn {
if (pre_monitor_count != post_monitor_count) {
final long monitor_count_change = post_monitor_count - pre_monitor_count;
System.out.println("Unexpected change in monitor count: " + monitor_count_change);
// Intermittent deflation and inflation may occur due to running the test
// with stress flags (like DeoptimizeALot) or with added instrumentation
// which runs in the same VM.
// An arbitrary fuzzy max difference of 10 (= 0.01% of COUNT) is chosen to
// allow for these occurrences to be skipped while still catching regressions.
final long fuzzy_max_difference = 10;
if (Math.abs(monitor_count_change) < fuzzy_max_difference) {
final String type = monitor_count_change < 0 ? "deflation" : "inflation";
throw new SkippedException("Intermittent " + type + " detected. Invalid test.");
}
if (monitor_count_change < 0) {
throw new RuntimeException("Unexpected Deflation");
}