Skip to content

Skip directory fsync on Windows in local file cache store - #4700

Open
SarthakRawat-1 wants to merge 1 commit into
buildkite:mainfrom
SarthakRawat-1:fix-windows-cache-dir-sync
Open

SarthakRawat-1 wants to merge 1 commit into
buildkite:mainfrom
SarthakRawat-1:fix-windows-cache-dir-sync

Conversation

@SarthakRawat-1

Copy link
Copy Markdown
Contributor

Description

On Windows, calling FlushFileBuffers via dir.Sync() on directory handles opened with os.Open fails with ERROR_ACCESS_DENIED. On Windows NTFS, metadata operations are automatically journaled by the filesystem, making directory fsyncing both unsupported and unnecessary.

This change skips directory syncing on Windows in LocalFileBlob.Upload and Download, eliminating false WARN failed to fsync directory ...: Access is denied. log messages during cache save and restore while preserving directory durability syncing on POSIX systems.

Fixes #4699

Context

See #4699 for details and steps to reproduce.

Changes

  • internal/cache/store/file.go: Add syncDir helper that no-ops on Windows and calls dir.Sync() on other platforms; use it in Upload and Download.
  • internal/cache/store/file_test.go: Add TestSyncDir regression test.

Public documentation

Status: not needed

Testing

  • Code formatted with go tool gofumpt -extra -w .
  • go vet ./internal/cache/... passes with zero warnings.
  • Ran test suite with go test ./internal/cache/....
  • Verified that TestLocalFileBlobUpload, TestLocalFileBlobDownload, TestLocalFileBlobUploadOverwrite, and TestLocalFileBlobStat run cleanly without emitting Access is denied warnings.

Affiliation (optional, external contributors)

Disclosures / Credits

I used Gemini to help investigate the handle leak, draft Windows regression tests, and editing issue & PR description for clarity and clear drafting.

@SarthakRawat-1
SarthakRawat-1 requested a review from a team as a code owner November 27, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spurious "failed to fsync directory: Access is denied" warnings during file cache operations on Windows

1 participant