{"record":{"id":"0f6b3c9e2cc550a4","repo":"apache/cassandra","slug":"non-fatal-checksum-error-reading-saved-cache","errorCode":null,"errorMessage":"Non-fatal checksum error reading saved cache {}: {}","messagePattern":"Non-fatal checksum error reading saved cache (.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/cache/AutoSavingCache.java","lineNumber":274,"sourceCode":"                        }\n\n                        if (futures.size() > 1000)\n                            Thread.yield();\n                    } while(futures.size() > 1000);\n                }\n\n                Future<Pair<K, V>> future = null;\n                while ((future = futures.poll()) != null)\n                {\n                    Pair<K, V> entry = future.get();\n                    if (entry != null && entry.right != null)\n                        put(entry.left, entry.right);\n                }\n            }\n            catch (CorruptFileException e)\n            {\n                JVMStabilityInspector.inspectThrowable(e);\n                logger.warn(\"Non-fatal checksum error reading saved cache {}: {}\", dataPath.absolutePath(), e.getMessage());\n            }\n            catch (Throwable t)\n            {\n                JVMStabilityInspector.inspectThrowable(t);\n                logger.info(\"Harmless error reading saved cache {}: {}\", dataPath.absolutePath(), t.getMessage());\n            }\n            finally\n            {\n                FileUtils.closeQuietly(in);\n                cacheLoader.cleanupAfterDeserialize();\n            }\n        }\n        if (logger.isTraceEnabled())\n            logger.trace(\"completed reading ({} ms; {} keys) saved cache {}\",\n                         TimeUnit.NANOSECONDS.toMillis(nanoTime() - start), count, dataPath);\n        return count;\n    }\n","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cache/AutoSavingCache.java#L256-L292","documentation":"A warning logged when loading a saved key cache/row cache file fails a checksum (CorruptFileException). Cassandra treats saved caches as an optimization only: the corrupt file is discarded, JVMStabilityInspector inspects the throwable, and startup continues with an empty cache. It is deliberately non-fatal.","triggerScenarios":"Node restart with saved_cache enabled where the cache file in saved_caches_directory is truncated or corrupted — e.g. unclean shutdown (power loss / kill -9) mid-write, disk corruption, filesystem truncation, or manual copy of cache files between nodes.","commonSituations":"After a hard crash or OOM kill, cache files on disk are incomplete; moving cache files across nodes with different data (checksum no longer valid); corrupted storage medium; upgrading with stale cache files.","solutions":["No action strictly required — the node rebuilds the cache in memory; verify with nodetool info that key-cache/row-cache entries repopulate.","Delete the corrupt file from the saved_caches directory if the warning repeats, so it is regenerated cleanly.","Check disk/filesystem health (dmesg, fsck) since checksum failures can indicate hardware issues.","Avoid killing the node uncleanly; prefer graceful shutdown (nodetool drain then stop) to get consistent cache saves."],"exampleFix":"// before (recurring corruption)\n# leave stale cache file in place\n// after\nrm /var/lib/cassandra/saved_caches/*-key-cache-* && restart node to regenerate","handlingStrategy":"try-catch","validationCode":"// before relying on saved caches, check the file parses\nFile f = new File(savedCachesDir, \"KeyCache\");\nif (f.length() == 0 || !f.canRead()) logger.warn(\"saved cache missing/truncated: {}\", f);","typeGuard":null,"tryCatchPattern":"try {\n    cache.loadSaved();\n} catch (CorruptFileException e) {\n    logger.warn(\"Discarding corrupt saved cache, continuing with cold cache\", e);\n}","preventionTips":["Shut down nodes gracefully (nodetool drain) so cache saves complete.","Do not copy saved cache files between nodes.","Monitor disks for corruption; repeated checksum failures indicate hardware/filesystem problems."],"tags":["cache","corruption","startup","restart"],"backgroundTag":"checksum-mismatch","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"}