fix(core): prevent os error 33 on Windows by reading usearch index from locked file handle#747
Merged
ajianaz merged 2 commits intoJul 21, 2026
Conversation
β¦om locked file handle
Collaborator
|
Thanks for opening the new PR targeting Almost there β one CI check is failing:
You can fix the formatting by running: cargo fmt --allThen commit the changes and push. Once CI is green, we'll get this merged! π |
This was referenced Jul 21, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes the Windows \ERROR_LOCK_VIOLATION\ (\os error 33) described in #732 that breaks the multi-agent CLI workflow.
Root cause:
The \VectorIndex::load_or_create\ function acquired an exclusive cross-process lock on the .usearch\ file, but then called \std::fs::read(path). On Windows, byte-range locks are enforced at the OS handle level. \std::fs::read\ attempts to open a second handle to the same file and read from the locked region, resulting in an immediate lock violation from the OS.
Solution:
Instead of opening a new handle, the \load_from_file\ method now reads the file contents directly from the already-locked \File\ handle before deserializing.
Changes
Testing
Closes #732.