{"record":{"id":"6b9a7d34de4a18d5","repo":"microsoft/FASTER","slug":"invalid-checksum-found-during-scan-skipping","errorCode":null,"errorMessage":"Invalid checksum found during scan, skipping","messagePattern":"Invalid checksum found during scan, skipping","errorType":"exception","errorClass":"FasterException","httpStatus":null,"severity":"error","filePath":"cs/src/core/FasterLog/FasterLogIterator.cs","lineNumber":853,"sourceCode":"                }\n\n                int recordSize = headerSize + Align(entryLength);\n                if (_currentOffset + recordSize > allocator.PageSize)\n                {\n                    currentAddress += headerSize;\n                    if (Utility.MonotonicUpdate(ref nextAddress, currentAddress, out _))\n                        throw new FasterException(\"Invalid length of record found: \" + entryLength + \" at address \" + currentAddress);\n                    continue;\n                }\n\n                // Verify checksum if needed\n                if (currentAddress < _headAddress)\n                {\n                    if (!fasterLog.VerifyChecksum((byte*)physicalAddress, entryLength))\n                    {\n                        currentAddress += headerSize;\n                        if (Utility.MonotonicUpdate(ref nextAddress, currentAddress, out _))\n                            throw new FasterException(\"Invalid checksum found during scan, skipping\");\n                        continue;\n                    }\n                }\n\n                if ((currentAddress & allocator.PageSizeMask) + recordSize == allocator.PageSize)\n                    currentAddress = (1 + (currentAddress >> allocator.LogPageSizeBits)) << allocator.LogPageSizeBits;\n                else\n                    currentAddress += recordSize;\n\n                if (Utility.MonotonicUpdate(ref nextAddress, currentAddress, out long oldCurrentAddress))\n                {\n                    outNextAddress = currentAddress;\n                    currentAddress = oldCurrentAddress;\n                    return true;\n                }\n            }\n        }\n","sourceCodeStart":835,"sourceCodeEnd":871,"githubUrl":"https://github.com/microsoft/FASTER/blob/321d872eabda6a0345c8bd76419f89723ed864ae/cs/src/core/FasterLog/FasterLogIterator.cs#L835-L871","documentation":"The iterator verified a record's checksum below the head address and it did not match (FasterLogIterator.cs:853). The record's data was corrupted after being committed, so the iterator skips past it and throws to alert the caller that durable data was compromised.","triggerScenarios":"Scanning older (already checkpointed/on-disk) regions where a record's bytes were mutated — storage bit rot, torn page writes, or copying log files without a checkpoint; hardware faults.","commonSituations":"Restored backups whose files were manually modified; NFS/network storage with silent corruption; partial checkpoint restore; disk returning stale data after a crash.","solutions":["Restore the affected page(s) from a known-good checkpoint or backup.","Check and repair storage health (fsck/SMART); avoid storage layers without end-to-end integrity.","If tolerable, catch this exception in the iteration loop and treat it as a poison-record skip, continuing the scan.","Re-verify the whole log after recovery and re-run any side effects derived from the corrupt records."],"exampleFix":"// before\nawait foreach (var e in iter.GetAsyncEnumerable()) { ... } // throws mid-scan\n\n// after\nwhile (iter.GetNext(out var entry, out var addr))\n{\n    try { Process(entry, addr); }\n    catch (FasterException ex) when (ex.Message.Contains(\"Invalid checksum\")) { /* skip poisoned record */ }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"while (iter.GetNext(out var entry, out var addr))\n{\n    try { Process(entry, addr); }\n    catch (FasterException ex) when (ex.Message.Contains(\"Invalid checksum\")) { logWarn(addr); continue; }\n}","preventionTips":["Use storage with end-to-end data integrity","Restore only whole checkpoint sets","Periodically audit old log regions for bit rot"],"tags":["fasterlog","iterator","checksum","corruption"],"backgroundTag":"checksum-mismatch","analyzedSha":"321d872eabda6a0345c8bd76419f89723ed864ae","analyzedAt":"2026-09-15T22:18:00.693Z","contentChangedAt":"2026-09-15T22:18:00.693Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}