{"record":{"id":"9959905ae859dd85","repo":"apache/cassandra","slug":"failed-to-close-zstddictdecompress","errorCode":null,"errorMessage":"Failed to close ZstdDictDecompress","messagePattern":"Failed to close ZstdDictDecompress","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/db/compression/ZstdCompressionDictionary.java","lineNumber":296,"sourceCode":"                catch (Exception e)\n                {\n                    // Log but don't fail - continue closing other resources\n                    logger.warn(\"Failed to close ZstdDictCompress\", e);\n                }\n            }\n            zstdDictCompressPerLevel.clear();\n\n            // Close decompression dictionary\n            ZstdDictDecompress decompressDict = dictDecompress.get();\n            if (decompressDict != null)\n            {\n                try\n                {\n                    decompressDict.close();\n                }\n                catch (Exception e)\n                {\n                    logger.warn(\"Failed to close ZstdDictDecompress\", e);\n                }\n                dictDecompress.set(null);\n            }\n        }\n\n        @Override\n        public String name()\n        {\n            return ZstdCompressionDictionary.class.getSimpleName();\n        }\n    }\n}\n","sourceCodeStart":278,"sourceCodeEnd":309,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compression/ZstdCompressionDictionary.java#L278-L309","documentation":"Logged in the same tidy path as the compress-side warning, but for ZstdDictDecompress: closing the per-thread decompression zstd native dictionary threw. As with 2841, the exception is swallowed so the remainder of the close sequence completes, but the native decompression dictionary may not have been released.","triggerScenarios":"A compression dictionary instance is being disposed (sstable deletion, table drop, dictionary churn during compaction) and decompressDict.close() throws on the native handle; double-close or use-after-free of the zstd buffer.","commonSituations":"Compaction removing sstables that used trained zstd dictionaries; dropping tables; node decommission that discards dictionary-backed sstables; observing rising native (non-heap) memory after repeated warnings.","solutions":["Single warnings are benign; correlate with native memory metrics before investigating.","Check that no stale/mismatched libzstd is loaded (LD_LIBRARY_PATH) conflicting with Cassandra's bundled zstd.","Reduce rapid dictionary churn (aggressive dictionary training cadence) if warnings recur under compaction load.","If leaks persist, restart the node and report to the project with logs."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    decompressDict.close();\n} catch (Exception e) {\n    logger.warn(\"Failed to close ZstdDictDecompress\", e); // swallow, continue cleanup\n}","preventionTips":["Same as compress-side: monitor native memory, avoid forced evictions, keep native libs consistent.","Watch for correlated warnings during heavy compaction and space out dictionary training.","Restart nodes only if native memory metrics confirm leakage."],"tags":["cassandra","zstd","compression","resource-cleanup","native"],"backgroundTag":"resource-cleanup-failed","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}