{"record":{"id":"01797233fa1d5b91","repo":"apache/cassandra","slug":"journalreaderror-descriptor-file-e","errorCode":null,"errorMessage":"JournalReadError(descriptor, file, e)","messagePattern":"JournalReadError\\(descriptor, file, e\\)","errorType":"exception","errorClass":"JournalReadError","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/journal/StaticSegment.java","lineNumber":470,"sourceCode":"                    switch (crcFailurePolicy)\n                    {\n                        case IGNORE: break;\n                        case IGNORE_ALL_ZERO_RECORDS:\n                            if (areAllBytesZero(buffer, offset + Integer.BYTES, e.knownLength - Integer.BYTES))\n                                break;\n                        case IGNORE_CRC_ZERO_RECORDS:\n                            if (e.readCrc == 0)\n                                break;\n                        case FAIL:\n                            throw new JournalReadError(descriptor, file, e.getCause());\n                    }\n\n                    logger.warn(\"Caught a recoverable journal error, skipping bytes\", e);\n                    buffer.position(offset + e.knownLength);\n                }\n                catch (IOException e)\n                {\n                    throw new JournalReadError(descriptor, file, e);\n                }\n            }\n        }\n\n        private void reset()\n        {\n            offset = -1;\n            holder.clear();\n            state = State.RESET;\n        }\n    }\n\n    public static boolean areAllBytesZero(ByteBuffer buffer, int start, int length)\n    {\n        int mod8 = (length/8) * 8;\n        // Make sure all bytes are zero\n        for (int i = 0; i < mod8; i += Long.BYTES)\n        {","sourceCodeStart":452,"sourceCodeEnd":488,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/journal/StaticSegment.java#L452-L488","documentation":"StaticSegment.Reader.doAdvance catches IOException while deserializing entries and wraps it in JournalReadError, associating the failure with the segment descriptor and file. This marks the segment unreadable at that position so callers can apply recovery policy (skip or fail).","triggerScenarios":"IOException during buffer advance/entry parsing — corrupt entry bytes, unexpected EOF within an entry, or I/O errors reading the mapped file (e.g. underlying storage failure).","commonSituations":"Torn writes after a crash; disk corruption on the journal volume; reading segments transferred incompletely between nodes.","solutions":["Inspect the wrapped IOException cause; if recoverable, the configured RecoverableCrcFailurePolicy may skip the bad bytes","Run journal reserialization/recovery to rebuild or drop the corrupt segment","Check filesystem/disk health on the journal volume","Restore the segment from a snapshot taken before the corruption"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// verify CRC of segment tail before full iteration, or use the configured failure policy to pre-scan\npreScan(descriptor, crcFailurePolicy);","typeGuard":null,"tryCatchPattern":"try { reader.advance(); } catch (JournalReadError e) { if (e.getCause() instanceof IOException) applyRecoveryPolicy(e); else throw e; }","preventionTips":["Configure an appropriate RecoverableCrcFailurePolicy for your durability needs","Run reserialization after unclean shutdowns","Monitor storage health on journal volumes","Snapshot segments before recovery attempts"],"tags":["journal","corruption","io-exception"],"backgroundTag":"file-read-failed","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}