{"record":{"id":"b0323ff32127fba3","repo":"microsoft/FASTER","slug":"error-flushing-page-pageindex-to-device","errorCode":null,"errorMessage":"Error flushing page {pageIndex} to device","messagePattern":"Error flushing page (.+?) to device","errorType":"exception","errorClass":"FasterException","httpStatus":null,"severity":"error","filePath":"cs/src/core/Index/Recovery/Recovery.cs","lineNumber":103,"sourceCode":"        internal void SignalFlushed(int pageIndex)\n        {\n            this.flushStatus[pageIndex] = FlushStatus.Done;\n            this.flushSemaphore.Release();\n        }\n\n        internal void SignalFlushedError(int pageIndex)\n        {\n            this.flushStatus[pageIndex] = FlushStatus.Error;\n            this.flushSemaphore.Release();\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        internal void WaitFlush(int pageIndex)\n        {\n            while (this.flushStatus[pageIndex] == FlushStatus.Pending)\n                this.flushSemaphore.Wait();\n            if (this.flushStatus[pageIndex] == FlushStatus.Error)\n                throw new FasterException($\"Error flushing page {pageIndex} to device\");\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        internal async ValueTask WaitFlushAsync(int pageIndex, CancellationToken cancellationToken)\n        {\n            while (this.flushStatus[pageIndex] == FlushStatus.Pending)\n                await this.flushSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);\n            if (this.flushStatus[pageIndex] == FlushStatus.Error)\n                throw new FasterException($\"Error flushing page {pageIndex} to device\");\n        }\n\n        internal void Dispose()\n        {\n            recoveryDevice.Dispose();\n            objectLogRecoveryDevice.Dispose();\n        }\n    }\n","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/microsoft/FASTER/blob/321d872eabda6a0345c8bd76419f89723ed864ae/cs/src/core/Index/Recovery/Recovery.cs#L85-L121","documentation":"Recovery.WaitFlush blocks until the flush of pageIndex completes (flushStatus leaves Pending), then throws FasterException if the flush ended in FlushStatus.Error. It propagates a device write failure encountered while flushing log pages during checkpointing/commit. Called from WaitUntilAllPagesHaveBeenFlushed, so it aborts the checkpoint.","triggerScenarios":"Taking a checkpoint or committing and waiting for all pages to flush when the device write of pageIndex fails — disk full, device handle closed, storage error, or unsupported device configuration.","commonSituations":"Disk-full during checkpoint, network storage blips with remote devices, or writing to a removable drive that was disconnected.","solutions":["Check free disk space and the underlying device error; free space or remount storage and retry the checkpoint.","Ensure the log/checkpoint devices are healthy and not disposed before flush completes.","Add retry logic around checkpointing, and configure an earlier checkpoint to roll back to if this one fails."],"exampleFix":"// before\nstore.TakeFullCheckpoint(Guid.NewGuid()); // disk full\n// after\nEnsureDiskSpace(ckptDrive, requiredBytes: EstimateCheckpointSize(store));\nstore.TakeFullCheckpoint(Guid.NewGuid());","handlingStrategy":"try-catch","validationCode":"var drive = new DriveInfo(Path.GetPathRoot(ckptDir));\nif (drive.AvailableFreeSpace < estimatedCheckpointBytes)\n    throw new IOException($\"Insufficient space for checkpoint: need {estimatedCheckpointBytes}, have {drive.AvailableFreeSpace}\");","typeGuard":null,"tryCatchPattern":"try { store.TakeFullCheckpoint(guid); store.CompleteCheckpoint(); }\ncatch (FasterException ex) when (ex.Message.Contains(\"Error flushing page\"))\n{ logger.LogCritical(ex, \"Checkpoint flush failed\"); RollBackToLastGoodCheckpoint(); }","preventionTips":["Alert on free-disk-space thresholds well before checkpoints run.","Never dispose devices while checkpoints or commits are in flight.","Retain a known-good checkpoint to roll back to when a flush fails."],"tags":["faster","io","flush","checkpoint","csharp"],"backgroundTag":"file-write-failed","analyzedSha":"321d872eabda6a0345c8bd76419f89723ed864ae","analyzedAt":"2026-09-15T22:18:00.693Z","contentChangedAt":"2026-09-15T22:18:00.693Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}