apache/cassandra · warning

The JVM is not configured to stop on OutOfMemoryError which

Error message

The JVM is not configured to stop on OutOfMemoryError which can cause data corruption. Use one of the following JVM options to configure the behavior on OutOfMemoryError:  -XX:+ExitOnOutOfMemoryError, -XX:+CrashOnOutOfMemoryError, or -XX:OnOutOfMemoryError="<cmd args>;<cmd args>"

What it means

On a HotSpot/OpenJDK JVM, checkOutOfMemoryHandling verifies that at least one -XX:OnOutOfMemoryError=, -XX:+ExitOnOutOfMemoryError, or -XX:+CrashOnOutOfMemoryError option is present when the JVM supports them (Java >= 8u92 per JavaUtils.supportExitOnOutOfMemory). Without one, a node that hits OutOfMemoryError keeps running in a corrupt/undefined state, which can cause data corruption. This is a logged warning during startup.

Source

Thrown at src/java/org/apache/cassandra/service/StartupChecks.java:620

            if (!(javaVmName.contains("HotSpot") || javaVmName.contains("OpenJDK")))
            {
                logger.warn("Non-Oracle JVM detected.  Some features, such as immediate unmap of compacted SSTables, may not work as intended");
            }
            else
            {
                checkOutOfMemoryHandling();
            }
        }

        /**
         * Checks that the JVM is configured to handle OutOfMemoryError
         */
        private void checkOutOfMemoryHandling()
        {
            if (JavaUtils.supportExitOnOutOfMemory(JAVA_VERSION.getString()))
            {
                if (!jvmOptionsContainsOneOf("-XX:OnOutOfMemoryError=", "-XX:+ExitOnOutOfMemoryError", "-XX:+CrashOnOutOfMemoryError"))
                    logger.warn("The JVM is not configured to stop on OutOfMemoryError which can cause data corruption."
                                + " Use one of the following JVM options to configure the behavior on OutOfMemoryError: "
                                + " -XX:+ExitOnOutOfMemoryError, -XX:+CrashOnOutOfMemoryError, or -XX:OnOutOfMemoryError=\"<cmd args>;<cmd args>\"");
            }
            else
            {
                if (!jvmOptionsContainsOneOf("-XX:OnOutOfMemoryError="))
                    logger.warn("The JVM is not configured to stop on OutOfMemoryError which can cause data corruption."
                            + " Either upgrade your JRE to a version greater or equal to 8u92 and use -XX:+ExitOnOutOfMemoryError/-XX:+CrashOnOutOfMemoryError"
                            + " or use -XX:OnOutOfMemoryError=\"<cmd args>;<cmd args>\" on your current JRE.");
            }
        }

        /**
         * Checks if one of the specified options is being used.
         * @param optionNames The name of the options to check
         * @return {@code true} if one of the specified options is being used, {@code false} otherwise.
         */
        private boolean jvmOptionsContainsOneOf(String... optionNames)

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Add -XX:+ExitOnOutOfMemoryError to jvm.options (or JVM_OPTS) and restart.
  2. Alternatively add -XX:+CrashOnOutOfMemoryError if you want a core dump for diagnosis.
  3. Use -XX:OnOutOfMemoryError="<cmd args>" to run a custom handler script (e.g. kill the process, alert).
  4. Verify with `ps -ef | grep cassandra` or jcmd VM.flags that the option took effect.

Example fix

// before (jvm.options)
# no OOM handling option
// after (jvm.options)
-XX:+ExitOnOutOfMemoryError
Defensive patterns

Strategy: validation

Validate before calling

// Check effective JVM flags before startup
Process p = Runtime.getRuntime().exec(new String[]{"sh","-c","jcmd 0 VM.flags | grep -E 'ExitOnOutOfMemoryError|CrashOnOutOfMemoryError|OnOutOfMemoryError'")});
if (p.waitFor() == 0 && new String(p.getInputStream().readAllBytes()).isBlank()) {
    System.out.println("Add -XX:+ExitOnOutOfMemoryError to jvm.options");
}

Prevention

When it happens

Trigger: JVM version >= 8u92, JVM args (JVM_OPTS / jvm.options / cassandra-env.sh) contain none of the three -XX OOM-handling options when StartupChecks run.

Common situations: Hand-edited jvm11/jvm17 options files that dropped the flag, custom launchers bypassing cassandra-env.sh, docker images overriding JVM_OPTS, upgrades where the OOM flag was lost in a merge.

Understand the failure class

Background: "missing required config value" errors: why libraries refuse to start when a configuration key is empty, unset, or blank — this error's family across 48 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/7786f618ea6852d7. Report an issue: GitHub.