Skip to content

fix(core): prevent os error 33 on Windows by reading usearch index from locked file handle#747

Merged
ajianaz merged 2 commits into
codecoradev:developfrom
webhop123:fix/windows-os33-double-handle
Jul 21, 2026
Merged

fix(core): prevent os error 33 on Windows by reading usearch index from locked file handle#747
ajianaz merged 2 commits into
codecoradev:developfrom
webhop123:fix/windows-os33-double-handle

Conversation

@webhop123

Copy link
Copy Markdown

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

  • Extracted a \load_from_file(&mut File, &Path)\ method in \crates/uteke-core/src/memory/vector.rs.
  • \load_or_create\ now passes its exclusive \lock_file\ directly to \load_from_file, avoiding a second conflicting file handle.

Testing

  • Validated via \cargo check\ locally.
  • Solves the documented multi-process bug where the second CLI process fails to read an existing store.

Closes #732.

@ajianaz

ajianaz commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Thanks for opening the new PR targeting develop, @webhop123! πŸ‘

Almost there β€” one CI check is failing:

Check Status
Build βœ…
Check βœ…
Clippy βœ…
Cora Review βœ…
Cargo Audit βœ…
Test βœ…
Trivy FS Scan βœ…
Format ❌

You can fix the formatting by running:

cargo fmt --all

Then commit the changes and push. Once CI is green, we'll get this merged! πŸš€

@ajianaz
ajianaz merged commit 6f2dc42 into codecoradev:develop Jul 21, 2026
9 checks passed
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.

[BUG] Windows: os error 33 (LOCK_VIOLATION) reading usearch index breaks multi-process CLI / documented multi-agent workflow

2 participants