fix(indexing): release write lock during reindex Finalizing phase - #18
Merged
Conversation
Root cause: IndexProjectRunner.run() held db_manager.begin_write() (the global _write_lock RLock) for the entire job, including the heavy LanceDB optimize()/create_index() calls in _safe_ivf_index(). Running those under the lock deadlocked the 'Finalizing' phase (both processes at 0% CPU, job never completed, ETA grew forever). Fix: - _safe_ivf_index() now temporarily releases the global write lock via _suspend_write_lock() around optimize()/create_index() (reindex guard is_reindexing() still blocks concurrent search, so safe). - Bound create_index with a timeout + non-blocking shutdown so a stalled LanceDB index build can no longer hang the reindex job forever. Regression guard: tests/test_reindex_finalizing_deadlock.py asserts optimize/create_index run with the lock released and that a hanging create_index does not block past the timeout.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ManSio
added a commit
that referenced
this pull request
Aug 28, 2026
Co-authored-by: MSCodeBase Agent <mscodebase@intelligence.local>
Copilot stopped work on behalf of
ManSio due to an error
August 28, 2026 19:15
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.
Root cause
IndexProjectRunner.run() held db_manager.begin_write() (the global _write_lock RLock) for the ENTIRE reindex job, including the heavy LanceDB optimize() / create_index() calls in _safe_ivf_index(). Running those operations under the global lock deadlocked the 'Finalizing' phase (both processes at 0% CPU, job never completed, ETA grew forever). The reindexing flag was therefore never cleared, permanently blocking concurrent search.
Fix
Regression guard
Test result
python -m pytest tests/test_reindex_finalizing_deadlock.py -q → 2 passed. Existing ests/test_reindex_responsive.py (9) and ests/test_index_runner_deadlock.py (4) still pass.