{"record":{"id":"e388943fa3bcc64f","repo":"microsoft/FASTER","slug":"failed-to-schedule-async-io","errorCode":null,"errorMessage":"Failed to schedule async IO: ","messagePattern":"Failed to schedule async IO: ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cc/src/environment/file_windows.cc","lineNumber":269,"sourceCode":"      callback);\n\n  ::StartThreadpoolIo(io_object_);\n\n  bool success = FALSE;\n  if(FileOperationType::Read == operationType) {\n    success = ::ReadFile(file_handle_, buffer, length, nullptr, &io_context->parent_overlapped);\n  } else {\n    success = ::WriteFile(file_handle_, buffer, length, nullptr, &io_context->parent_overlapped);\n  }\n  if(!success) {\n    DWORD win32_result = ::GetLastError();\n    // Any error other than ERROR_IO_PENDING means the IO failed. Otherwise it will finish\n    // asynchronously on the threadpool\n    if(ERROR_IO_PENDING != win32_result) {\n      ::CancelThreadpoolIo(io_object_);\n      std::stringstream ss;\n      ss << \"Failed to schedule async IO: \" << FormatWin32AndHRESULT(win32_result);\n      fprintf(stderr, \"%s\\n\", ss.str().c_str());\n      return Status::IOError;\n    }\n  }\n  io_context.release();\n  return Status::Ok;\n}\n\nbool QueueIoHandler::TryComplete() {\n  DWORD bytes_transferred;\n  ULONG_PTR completion_key;\n  LPOVERLAPPED overlapped = NULL;\n  bool succeeded = ::GetQueuedCompletionStatus(io_completion_port_, &bytes_transferred,\n                   &completion_key, &overlapped, 0);\n  if(overlapped) {\n    Status return_status;\n    if(!succeeded) {\n      return_status = Status::IOError;\n    } else {","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/microsoft/FASTER/blob/321d872eabda6a0345c8bd76419f89723ed864ae/cc/src/environment/file_windows.cc#L251-L287","documentation":"ThreadPoolFile::ScheduleOperation issues overlapped (async) I/O via the Windows thread pool. If the overlapped call returns anything other than ERROR_IO_PENDING, the I/O could not be queued; CancelThreadpoolIo is called, the formatted Win32/HRESULT error is printed, and Status::IOError is returned.","triggerScenarios":"Any async read/write through a ThreadPoolFile-backed device (Windows) where the overlapped I/O call fails immediately — e.g. invalid buffer alignment, insufficient quota, handle issues, disk full.","commonSituations":"Unaligned user buffers passed to FASTER on Windows, disk or paging-file quota exhaustion, failing/faulty storage devices, calling I/O after the file handle was invalidated.","solutions":["Inspect the FormatWin32AndHRESULT output on stderr for the exact Win32 error code","Ensure read/write buffers meet Windows overlapped-I/O alignment requirements","Check disk space, pagefile/quota settings and device health","Retry the operation; if persistent, reopen the device/log","Verify ERROR_IO_PENDING-style async expectations match your FASTER version"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"null","typeGuard":null,"tryCatchPattern":"Status s = kv.Read/Write(...);\nif (s == Status::IOError) {\n  // read the stderr 'Failed to schedule async IO: <win32 error>'\n  // fall back to sync I/O or retry with aligned buffers\n}","preventionTips":["Use FASTER-aligned buffer pools for user I/O","Monitor disk free space and quotas","Check the Windows event log for disk faults"],"tags":["windows","async-io","win32","threadpool"],"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"}