Skip to content

[IO] Add FILE_SHARE_READ for read-only opens on Windows#24005

Closed
jtuyls wants to merge 2 commits intoiree-org:mainfrom
jtuyls:fix-file-share-read-windows
Closed

[IO] Add FILE_SHARE_READ for read-only opens on Windows#24005
jtuyls wants to merge 2 commits intoiree-org:mainfrom
jtuyls:fix-file-share-read-windows

Conversation

@jtuyls
Copy link
Copy Markdown
Contributor

@jtuyls jtuyls commented Apr 3, 2026

On Windows, files opened for reading cannot be opened again by another reader — the second open fails with ERROR_SHARING_VIOLATION. This breaks workflows where multiple IREE sessions load the same parameter file (.irpa).

The first commit adds a test that reproduces the failure — confirmed on Windows CI: https://github.com/iree-org/iree/actions/runs/23940576218/job/69825870972

The second commit enables the fix: add FILE_SHARE_READ to read-only opens, matching POSIX behavior where multiple readers are always allowed.

@jtuyls jtuyls requested a review from benvanik as a code owner April 3, 2026 08:42
Without FILE_SHARE_READ, opening the same file twice for reading on
Windows fails with ERROR_SHARING_VIOLATION. Add a test that reproduces
this and a commented-out fix to enable after CI confirms the failure.

Signed-off-by: Jorn <jorn.tuyls@gmail.com>
@jtuyls jtuyls force-pushed the fix-file-share-read-windows branch from a8389f3 to d70b1e5 Compare April 3, 2026 08:54
Uncomment the fix now that CI confirmed the test failure on Windows.

Signed-off-by: Jorn <jorn.tuyls@gmail.com>
@jtuyls
Copy link
Copy Markdown
Contributor Author

jtuyls commented Apr 3, 2026

Closing as I should just use IREE_IO_FILE_MODE_SHARE_READ in call site.

@jtuyls jtuyls closed this Apr 3, 2026
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.

1 participant