{"record":{"id":"fa5fb0b30ab855b4","repo":"apache/cassandra","slug":"attempted-to-get-heap-dump-path-without-xx-heapdu","errorCode":null,"errorMessage":"Attempted to get heap dump path without -XX:HeapDumpPath or cassandra.yaml:heap_dump_path set.","messagePattern":"Attempted to get heap dump path without -XX:HeapDumpPath or cassandra\\.yaml:heap_dump_path set\\.","errorType":"validation","errorClass":"org.apache.cassandra.exceptions.ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":6097,"sourceCode":"     * misbehaving.\n     *\n     * @return the absolute path of the -XX param if provided, else the heap_dump_path in cassandra.yaml\n     */\n    public static Path getHeapDumpPath()\n    {\n        RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();\n        Optional<String> pathArg = runtimeMxBean.getInputArguments().stream().filter(s -> s.startsWith(\"-XX:HeapDumpPath=\")).findFirst();\n\n        if (pathArg.isPresent())\n        {\n            Pattern HEAP_DUMP_PATH_SPLITTER = Pattern.compile(\"HeapDumpPath=\");\n            String fullHeapPathString = HEAP_DUMP_PATH_SPLITTER.split(pathArg.get())[1];\n            Path absolutePath = File.getPath(fullHeapPathString).toAbsolutePath();\n            Path basePath = fullHeapPathString.endsWith(\".hprof\") ? absolutePath.subpath(0, absolutePath.getNameCount() - 1) : absolutePath;\n            return File.getPath(\"/\").resolve(basePath);\n        }\n        if (conf.heap_dump_path == null)\n            throw new ConfigurationException(\"Attempted to get heap dump path without -XX:HeapDumpPath or cassandra.yaml:heap_dump_path set.\");\n        return File.getPath(conf.heap_dump_path);\n    }\n\n    public static void setDumpHeapOnUncaughtException(boolean enabled)\n    {\n        conf.dump_heap_on_uncaught_exception = enabled;\n        boolean pathExists = maybeCreateHeapDumpPath();\n\n        if (enabled && !pathExists)\n        {\n            logger.error(\"Attempted to enable heap dump but cannot create the requested path. Disabling.\");\n            conf.dump_heap_on_uncaught_exception = false;\n        }\n        else\n            logger.info(\"Setting dump_heap_on_uncaught_exception to {}\", enabled);\n    }\n\n    public static boolean getSStableReadRatePersistenceEnabled()","sourceCodeStart":6079,"sourceCodeEnd":6115,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L6079-L6115","documentation":"The heap dump path resolution first checks the JVM's -XX:HeapDumpPath flag; if absent, it falls back to cassandra.yaml's heap_dump_path. When neither is configured, the getter throws ConfigurationException because it cannot determine where to write heap dumps for dump_heap_on_uncaught_exception.","triggerScenarios":"Enabling dump_heap_on_uncaught_exception (via DatabaseDescriptor.setDumpHeapOnUncaughtException(true) or cassandra.yaml) and then triggering heap dump path lookup without setting -XX:HeapDumpPath in jvm.options or heap_dump_path in cassandra.yaml.","commonSituations":"Operators enable heap dump on OOM/uncaught exception but forget to configure a dump directory; containers where the JVM flag was stripped; configs migrated from versions without heap_dump_path support.","solutions":["Set heap_dump_path in cassandra.yaml to a writable directory.","Or add -XX:HeapDumpPath=/path/to/dir to jvm.options / JAVA_OPTS.","Or disable dump_heap_on_uncaught_exception if heap dumps are not needed.","Ensure the configured path exists and the cassandra user can write to it."],"exampleFix":"// before (cassandra.yaml)\n# heap_dump_path:\n// after (cassandra.yaml)\nheap_dump_path: /var/lib/cassandra/heapdumps/","handlingStrategy":"validation","validationCode":"boolean heapDumpConfigured = System.getProperty(\"jvm.options\") != null /* or check jvm args for -XX:HeapDumpPath */ || cassandraYaml.hasPath(\"heap_dump_path\");","typeGuard":"null","tryCatchPattern":"try { Path p = DatabaseDescriptor.getHeapDumpPath(); } catch (ConfigurationException e) { log.error(\"heap_dump_path not configured\", e); }","preventionTips":["Always set -XX:HeapDumpPath in jvm.options or heap_dump_path in cassandra.yaml before enabling dump_heap_on_uncaught_exception.","Verify the path exists and is writable by the cassandra user at startup.","In containers, confirm the JVM flag survives entrypoint rewriting."],"tags":["configuration","jvm","heap-dump"],"backgroundTag":"missing-required-config-field","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}