mirror of
https://github.com/containerd/containerd.git
synced 2026-08-09 01:21:15 +00:00
On Windows, os.RemoveAll and os.ReadFile can fail with a sharing violation when a file handle has not been fully released by the OS. Unlike Unix, Windows does not allow deleting or reading a file while any handle is open, and handles may be held briefly after Close returns. This causes a race between the gRPC server-side writer Close (which writes updatedat.tmp) and both Abort (which calls RemoveAll on the ingest directory) and status (which reads the updatedat file), surfacing as a flaky TestContentClient/CommitErrorState on Windows CI. Add platform-specific removePath and readFileWithRetry helpers that retry with incremental backoff on Windows. On non-Windows platforms they pass through to os.RemoveAll and os.ReadFile directly. This follows the same pattern as ensureRemoveAll in the CRI server helpers, which retries on EBUSY for mount races on Linux. Signed-off-by: ayush-panta <ayushkp@amazon.com>