{"record":{"id":"4cb242f6c9b5cf3b","repo":"apache/cassandra","slug":"failed-to-release-compression-dictionary","errorCode":null,"errorMessage":"Failed to release compression dictionary {}","messagePattern":"Failed to release compression dictionary (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/db/compression/CompressionDictionaryCache.java","lineNumber":81,"sourceCode":"        this.cache = Caffeine.newBuilder()\n                             .maximumSize(maximumSize)\n                             .expireAfterAccess(Duration.ofSeconds(expireAfterSeconds))\n                             .removalListener((DictId dictId,\n                                               CompressionDictionary dictionary,\n                                               RemovalCause cause) -> {\n                                 // Release the cache's reference to the dictionary when evicted\n                                 // The dictionary will only be truly cleaned up when all references are released\n                                 if (dictionary != null)\n                                 {\n                                     try\n                                     {\n                                         // The dictionary's selfRef should never be null when evicting from cache\n                                         // but using close() to have better resiliency\n                                         dictionary.close();\n                                     }\n                                     catch (Exception e)\n                                     {\n                                         logger.warn(\"Failed to release compression dictionary {}\", dictId, e);\n                                     }\n                                 }\n                             })\n                             .executor(ImmediateExecutor.INSTANCE)\n                             .build();\n    }\n\n    @Nullable\n    @Override\n    public CompressionDictionary getCurrent()\n    {\n        DictId dictId = currentDictId.get();\n        return dictId == null ? null : get(dictId);\n    }\n\n    @Nullable\n    @Override\n    public CompressionDictionary get(DictId dictId)","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compression/CompressionDictionaryCache.java#L63-L99","documentation":"This log warning comes from the removal listener of the compression-dictionary cache: when a dictionary entry is evicted, closing the dictionary's shared ref failed with an exception. The eviction still happens; only resource cleanup of the dictionary (its Ref/selfRef) failed, potentially leaking off-heap resources.","triggerScenarios":"Cache eviction triggers dictionary.close() whose underlying shared ref is already closed or throws; logged with the dictId and the exception as a warn in the cache constructor's removalListener.","commonSituations":"Double-close races during aggressive cache churn; dictionary refs invalidated by table drop while entries are being evicted.","solutions":["Inspect the logged stack trace for the underlying close() failure (usually a StrRef already-closed IllegalStateException).","Check whether the table was dropped/disabled concurrently and avoid racing disable-dictionary with heavy read traffic.","If ref leaks recur, report/fix the close idempotency in CompressionDictionary; the warning itself needs no client action."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// operator-side: watch logs for this warning and the nested exception\nif (log.contains(\"Failed to release compression dictionary\")) {\n    inspectStackTrace(log); // determine double-close vs leak\n}","preventionTips":["Avoid dropping/disabling dictionary compression while heavy reads are evicting cache entries.","Watch for repeated occurrences signaling ref-count leaks."],"tags":["compression","dictionary-cache","resource-cleanup","logging"],"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"}