Skip to content

[GR-65348] Improve systemic compilation failure warning #11412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 16, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
remove SYSTEMIC_COMPILATION_FAILURE_WARNED
  • Loading branch information
dougxc committed May 26, 2025
commit 888575bddcbc47faf72f10cf20e8182c21392247
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,6 @@ private void maybeExitVM(ExceptionAction action) {
private static final long COMPILATION_FAILURE_DETECTION_PERIOD_NS = TimeUnit.SECONDS.toNanos(2);
private static final int MIN_COMPILATIONS_FOR_FAILURE_DETECTION = 25;

// Ensures the system compilation failure warning is printed once per VM process.
private static final GlobalAtomicLong SYSTEMIC_COMPILATION_FAILURE_WARNED = new GlobalAtomicLong("SYSTEMIC_COMPILATION_FAILURE_WARNED", 0L);

/**
* Gets the start of the current compilation period, initializing it to {@code initialValue} if
* this is the first period.
Expand Down Expand Up @@ -492,22 +489,20 @@ private static boolean detectCompilationFailureRateTooHigh(OptionValues options,
// Wait for period to expire or some minimum amount of compilations
// before detecting systemic failure.
if (rate > maxRate && (periodExpired || total > MIN_COMPILATIONS_FOR_FAILURE_DETECTION)) {
if (SYSTEMIC_COMPILATION_FAILURE_WARNED.compareAndSet(0L, 1L)) {
Formatter msg = new Formatter();
String option = GraalCompilerOptions.SystemicCompilationFailureRate.getName();
msg.format("Warning: Systemic Graal compilation failure detected: %d of %d (%d%%) of compilations failed during last %d ms [max rate set by %s is %d%%]. ",
failed, total, rate, TimeUnit.NANOSECONDS.toMillis(periodNS), option, maxRateValue);
msg.format("To mitigate systemic compilation failure detection, set %s to a higher value. ", option);
msg.format("To disable systemic compilation failure detection, set %s to 0. ", option);
StringWriter sw = new StringWriter();
cause.printStackTrace(new PrintWriter(sw));
msg.format("Current failure: %s", sw);
TTY.println(msg.toString());

if (maxRateValue < 0) {
// A negative value means the VM should be exited
return true;
}
Formatter msg = new Formatter();
String option = GraalCompilerOptions.SystemicCompilationFailureRate.getName();
msg.format("Warning: Systemic Graal compilation failure detected: %d of %d (%d%%) of compilations failed during last %d ms [max rate set by %s is %d%%]. ",
failed, total, rate, TimeUnit.NANOSECONDS.toMillis(periodNS), option, maxRateValue);
msg.format("To mitigate systemic compilation failure detection, set %s to a higher value. ", option);
msg.format("To disable systemic compilation failure detection, set %s to 0. ", option);
StringWriter sw = new StringWriter();
cause.printStackTrace(new PrintWriter(sw));
msg.format("Current failure: %s", sw);
TTY.println(msg.toString());

if (maxRateValue < 0) {
// A negative value means the VM should be exited
return true;
}
periodExpired = true;
}
Expand Down