Repository navigation
fix(#442): server deadlock on remember + cosine auto-linking never fires - #443
Merged
Merged
Conversation
Root cause: RwLock deadlock in remember_precomputed(). remember_precomputed() holds an RwLockWriteGuard on the vector index (variable `index`). It then calls auto_link_cosine(), which tries to acquire self.index.read() — a read lock on the SAME RwLock while the write lock is still held. This deadlocks the thread permanently. After 2-3 remember() calls, the server Mutex<Uteke> is held by the deadlocked thread, making the entire server unresponsive (even GET /health hangs). Fix: explicitly `drop(index)` (the write guard) BEFORE calling auto_link_cosine(). The index entry has already been inserted and saved, so the write lock is no longer needed. This also fixes the "no edges created" bug — auto_link_cosine was never reaching the search/edge-creation code because it deadlocked on the first read lock attempt.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-cli · BYOK · MIT |
This was referenced Jun 22, 2026
ajianaz
added a commit
that referenced
this pull request
Aug 13, 2026
…res (#443) Root cause: RwLock deadlock in remember_precomputed(). remember_precomputed() holds an RwLockWriteGuard on the vector index (variable `index`). It then calls auto_link_cosine(), which tries to acquire self.index.read() — a read lock on the SAME RwLock while the write lock is still held. This deadlocks the thread permanently. After 2-3 remember() calls, the server Mutex<Uteke> is held by the deadlocked thread, making the entire server unresponsive (even GET /health hangs). Fix: explicitly `drop(index)` (the write guard) BEFORE calling auto_link_cosine(). The index entry has already been inserted and saved, so the write lock is no longer needed. This also fixes the "no edges created" bug — auto_link_cosine was never reaching the search/edge-creation code because it deadlocked on the first read lock attempt.
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.
Critical Fix for #442
Root Cause: RwLock Deadlock
remember_precomputed()holds anRwLockWriteGuardon the vector index (variableindex). It then callsauto_link_cosine(), which tries to acquireself.index.read()— a read lock on the same RwLock while the write lock is still held.This deadlocks the thread permanently. After 2-3
remember()calls, the serverMutex<Uteke>is held by the deadlocked thread, making the entire server unresponsive (evenGET /healthhangs).Fix
Add
drop(index)before callingauto_link_cosine(). The index entry has already been inserted and saved, so the write lock is no longer needed.Also Fixes: No Edges Created
auto_link_cosine()was never reaching the search/edge-creation code because it deadlocked on the firstself.index.read()attempt. With the deadlock fixed,similar_toandpossible_duplicateedges will now be created correctly.Test