What does Windows error code 997 (ERROR_IO_PENDING) mean?

 
Previous Next
ERROR_IO_INCOMPLETE ERROR_NOACCESS

ERROR_IO_PENDING

ERROR_IO_PENDING means that an overlapped I/O request was accepted by Windows but has not finished yet. It is an expected intermediate status, not a failed read, write, device-control request, or named-pipe connection.

When it occurs

Functions such as ReadFile, WriteFile, DeviceIoControl, and ConnectNamedPipe can return FALSE immediately when the handle was opened for overlapped I/O. If GetLastError() then returns this result, the operation is owned by the I/O subsystem and will complete later.

What the caller must keep alive

Until completion is observed, the application must not reuse or destroy the OVERLAPPED structure. It must also keep the associated input or output buffer valid. Starting another operation with the same OVERLAPPED structure can corrupt the operation state or make its completion impossible to identify reliably.

How to obtain completion

Completion can be collected by waiting for the event stored in OVERLAPPED::hEvent, by calling GetOverlappedResult, by receiving an I/O completion port notification, or by using the completion mechanism required by the API. The result of the later completion, rather than this result, determines whether the operation ultimately succeeded.

Common mistake

Do not retry the same request merely because the initiating call returned FALSE with this result. Retrying may submit duplicate work. Treat this status as “in progress” and wait for the original request to finish.

See Microsoft documentation for ReadFile and GetOverlappedResult.


Looking for a different code? Search another status or error code.