Repository navigation
fix: preserve state when copy assignment allocation fails - #179
Merged
Merged
Conversation
TamimEhsan
pushed a commit
to TamimEhsan/khorgosh
that referenced
this pull request
Nov 2, 2026
num_threads=0 resolved to every available CPU and ignored the OpenMP thread limit. Since 0.8.0 defaults add() to 0, txtai's 0.7-style add(x) started an OpenMP worker team on macOS even though txtai sets OMP_NUM_THREADS=1 there. With Faiss and PyTorch loaded, each bundling its own libomp, starting those workers crashes (OMP Error VectorDB-NTU#179, then SIGSEGV). Resolve 0 to min(available CPUs, omp_get_max_threads()) like Faiss does; explicit positive requests are still capped only by the CPU count. Document the limit and the macOS mixed-runtime caveat. Fixes VectorDB-NTU#207
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.
Summary
Preserve valid state when copy assignment runs out of memory in
HashBasedVisitedSet,SplitSingleQuery, andFhtKacRotator. Prepare allocating storage before publishing metadata or borrowed pointers; the visited set copies both containers before replacing its state. Existing copy/move behavior, APIs and persisted layouts are preserved.These are failure-recovery fixes for callers that catch an allocation exception and reuse the destination. No trigger was established in normal ANN build/search paths. Transactional visited-set copies may allocate a full replacement even when the destination has spare capacity.
Testing
git diff --check, and full clang-tidy passed (46 translation units, including bindings).Python wheel tests were not rerun; no binding path invoking these assignments was identified.