Skip to content

Commit 4641682

Browse files
HumanBean17claude
andcommitted
fix(config): replace lancedb import with filesystem check to prevent Kuzu segfault
index_dir_has_existing_artifacts imported lancedb to check for existing Lance tables, spawning a LanceDBBackgroundEventLoop daemon thread. This thread causes Kuzu C++ segfaults in subsequent tests (kuzu is archived with known thread-safety bugs). Replace the lancedb import with a filesystem heuristic that checks for data.lance files inside subdirectories. Same detection capability, zero thread creation. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent ca96a07 commit 4641682

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

java_codebase_rag/config.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -393,14 +393,12 @@ def index_dir_has_existing_artifacts(index_dir: Path) -> tuple[bool, list[str]]:
393393
if ku.exists():
394394
paths.append(str(ku.resolve()))
395395
if index_dir.is_dir():
396-
try:
397-
import lancedb
398-
399-
db = lancedb.connect(str(index_dir.resolve()))
400-
for name in db.table_names():
401-
paths.append(str((index_dir / name).resolve()) + " (Lance table)")
402-
except Exception:
403-
pass
396+
# Check for Lance tables via filesystem to avoid importing lancedb,
397+
# which spawns a BackgroundEventLoop daemon thread that causes Kuzu
398+
# C++ segfaults in the same process.
399+
for child in index_dir.iterdir():
400+
if child.is_dir() and (child / "data.lance").exists():
401+
paths.append(str(child.resolve()) + " (Lance table)")
404402
return bool(paths), paths
405403

406404

0 commit comments

Comments
 (0)