{"record":{"id":"40490f1dbe87f40e","repo":"apache/cassandra","slug":"neither-xx-heapdumppath-nor-cassandra-yaml-heap-d","errorCode":null,"errorMessage":"Neither -XX:HeapDumpPath nor cassandra.yaml:heap_dump_path are set; unable to create a directory to hold the output.","messagePattern":"Neither -XX:HeapDumpPath nor cassandra\\.yaml:heap_dump_path are set; unable to create a directory to hold the output\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":6067,"sourceCode":"    }\n\n    public static boolean getDumpHeapOnUncaughtException()\n    {\n        return conf.dump_heap_on_uncaught_exception;\n    }\n\n    /**\n     * @return Whether the path exists (be it created now or already prior)\n     */\n    private static boolean maybeCreateHeapDumpPath()\n    {\n        if (!conf.dump_heap_on_uncaught_exception)\n            return false;\n\n        Path heap_dump_path = getHeapDumpPath();\n        if (heap_dump_path == null)\n        {\n            logger.warn(\"Neither -XX:HeapDumpPath nor cassandra.yaml:heap_dump_path are set; unable to create a directory to hold the output.\");\n            return false;\n        }\n        if (PathUtils.exists(File.getPath(conf.heap_dump_path)))\n            return true;\n        return PathUtils.createDirectoryIfNotExists(File.getPath(conf.heap_dump_path));\n    }\n\n    /**\n     * As this is at its heart a debug operation (getting a one-shot heapdump from an uncaught exception), we support\n     * both the more evolved cassandra.yaml approach but also the -XX param to override it on a one-off basis so you don't\n     * have to change the full config of a node or a cluster in order to get a heap dump from a single node that's\n     * 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();","sourceCodeStart":6049,"sourceCodeEnd":6085,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L6049-L6085","documentation":"When dump_heap_on_uncaught_exception is enabled, Cassandra checks before startup (or on fatal error) that a heap dump directory exists or can be created. If neither the -XX:HeapDumpPath JVM flag nor cassandra.yaml heap_dump_path is set, getHeapDumpPath() returns null and this warning is logged, disabling the heap dump feature. No exception is thrown.","triggerScenarios":"cassandra.yaml has dump_heap_on_uncaught_exception: true but heap_dump_path is unset and the JVM is started without -XX:HeapDumpPath; checked in DatabaseDescriptor.createHeapDumpPathIfNotExists().","commonSituations":"Operators enabling automatic heap dump on OOM/uncaught exceptions but forgetting to configure where dumps go; containers where the default path is not writable.","solutions":["Add heap_dump_path: /var/lib/cassandra/heapdump (or similar) to cassandra.yaml, or add -XX:HeapDumpPath=/path to jvm-server.options","Pre-create the directory with write permission for the cassandra user","If heap dumps are not wanted, set dump_heap_on_uncaught_exception: false"],"exampleFix":"// cassandra.yaml before\ndump_heap_on_uncaught_exception: true\n// after\ndump_heap_on_uncaught_exception: true\nheap_dump_path: /var/lib/cassandra/heapdump","handlingStrategy":"validation","validationCode":"if (cfg.dumpHeapOnUncaughtException && (cfg.heapDumpPath == null || cfg.heapDumpPath.isEmpty())\n    && System.getenv(\"JVM_EXTRA_OPTS\") != null && !System.getenv(\"JVM_EXTRA_OPTS\").contains(\"HeapDumpPath\"))\n    throw new IllegalStateException(\"dump_heap_on_uncaught_exception requires heap_dump_path or -XX:HeapDumpPath\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set -XX:HeapDumpPath in jvm-server.options when enabling heap dumps","Pre-create and chown the dump directory","Test heap dump creation in staging (jmap trigger)"],"tags":["cassandra","configuration","heap-dump","jvm"],"backgroundTag":"missing-config-value","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"}