{"record":{"id":"130655c8b49ba758","repo":"microsoft/FASTER","slug":"asyncflushpages-error-u","errorCode":null,"errorMessage":"AsyncFlushPages(), error: %u\n","messagePattern":"AsyncFlushPages\\(\\), error: %u\n","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cc/src/core/persistent_memory_malloc.h","lineNumber":869,"sourceCode":"    Context(const Context& other)\n      : allocator{ other.allocator }\n      , page{ other.page }\n      , until_address{ other.until_address } {\n    }\n   protected:\n    Status DeepCopy_Internal(IAsyncContext*& context_copy) final {\n      return IAsyncContext::DeepCopy_Internal(*this, context_copy);\n    }\n   public:\n    alloc_t* allocator;\n    uint32_t page;\n    Address until_address;\n  };\n\n  auto callback = [](IAsyncContext* ctxt, Status result, size_t bytes_transferred) {\n    CallbackContext<Context> context{ ctxt };\n    if(result != Status::Ok) {\n      log_error(\"AsyncFlushPages(), error: %u\\n\", static_cast<uint8_t>(result));\n    }\n    context->allocator->PageStatus(context->page).LastFlushedUntilAddress.store(\n      context->until_address);\n    //Set the page status to flushed\n    FlushCloseStatus old_status = context->allocator->PageStatus(context->page).status.load();\n    FlushCloseStatus new_status;\n    do {\n      new_status = FlushCloseStatus{ FlushStatus::Flushed, old_status.close };\n    } while(!context->allocator->PageStatus(context->page).status.compare_exchange_weak(\n              old_status, new_status));\n    if(old_status.close == CloseStatus::Closed) {\n      // We finished flushing the page after it was closed, so we are responsible for clearing and\n      // reopening it.\n      std::memset(context->allocator->Page(context->page), 0, kPageSize);\n      context->allocator->PageStatus(context->page).status.store(FlushStatus::Flushed,\n          CloseStatus::Open);\n    }\n    context->allocator->ShiftFlushedUntilAddress();","sourceCodeStart":851,"sourceCodeEnd":887,"githubUrl":"https://github.com/microsoft/FASTER/blob/321d872eabda6a0345c8bd76419f89723ed864ae/cc/src/core/persistent_memory_malloc.h#L851-L887","documentation":"This log_error fires inside the async flush-pages completion callback of PersistentMemoryMalloc::AsyncFlushPages. When the asynchronous file write of a log page completes with a Status other than Status::Ok, the callback logs the raw status code instead of throwing — the page's LastFlushedUntilAddress is still advanced. It indicates the underlying async disk flush of a FASTER log page failed (or was folded with a failure), which can leave durability guarantees broken.","triggerScenarios":"AsyncFlushPages / Flush (and hence safe checkpoints or log truncation) issues async writes via the device's async file IO; the completion returns a failed Status — e.g. disk full, I/O error, device closed/shutdown racing with pending writes, or failed file writes on Windows/Linux async IO paths.","commonSituations":"Disk out of space during checkpoint flush; storage device failures; shutting down a FASTER store while flushes are still in flight; misconfigured checkpoint directory (unmounted volume, permissions) so async writes fail.","solutions":["Inspect the logged status code (a FASTER Status enum value cast to uint8_t) and map it to the underlying device/file error","Check free disk space and the health of the checkpoint/log directory","Ensure the store (and its device) is not shut down or checkpointed concurrently in a way that outlives the device's lifetime; wait for checkpoints to complete before Close","Retry the checkpoint/flush after fixing the storage problem; verify durability with a checkpoint that completes with Status::Ok"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before checkpointing/flushing\nstruct statvfs st;\nif (statvfs(checkpoint_dir.c_str(), &st) != 0 || st.f_bavail * st.f_frsize < required_bytes) {\n  // abort checkpoint: not enough space for the flush\n}","typeGuard":null,"tryCatchPattern":"if (!store->Checkpoint(token, callback, ctx).IsPending() && /* completed with */ status != Status::Ok) {\n  // async flush failures are logged, not thrown; check the returned/adjunct status\n  std::cerr << \"Checkpoint flush failed; durability not guaranteed\\n\";\n  // retry after checking disk space / device health\n}","preventionTips":["Monitor free disk space on the checkpoint volume before initiating checkpoints","Never shut down or dispose the FASTER device while async flushes are pending — wait for checkpoint completion callbacks","Treat non-Ok statuses logged as 'AsyncFlushPages(), error' as a durability warning and re-checkpoint","Keep checkpoint directories on healthy, writable local storage (avoid flaky network mounts)"],"tags":["async-io","disk-flush","checkpoint","faster"],"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"}