Skip to content

Fix Kuzu shared-connection race with query lock - #881

Merged
Shashankss1205 merged 8 commits into
CodeGraphContext:mainfrom
DhineshPonnarasan:fix/kuzu-threadsafe-connection-lock
May 7, 2026
Merged

Shashankss1205 merged 8 commits into
CodeGraphContext:mainfrom
DhineshPonnarasan:fix/kuzu-threadsafe-connection-lock

Conversation

@DhineshPonnarasan

@DhineshPonnarasan DhineshPonnarasan commented May 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • serialize all Kuzu conn.execute() calls behind a shared hreading.RLock
  • thread _query_lock through KuzuDriverWrapper and KuzuSessionWrapper
  • add debug logging for idempotent �lready exists collisions
  • document cooperative-yield safety boundary in indexing pipeline
  • add dedicated concurrency regression tests for lock plumbing, serialization, reentrancy, and error behavior

Validation

  • python -m pytest tests/unit/core/test_kuzu_connection_lock.py -q -> 12 passed
  • python -m pytest tests/unit/core/test_database.py -q -> 15 passed
  • full unit suite has existing unrelated baseline failures in this environment

Fixes #880


@Shashankss1205 , could you please take a look when you have time?

Happy to incorporate any feedback including additional tests, refinements or scope adjustments if needed.

@vercel

vercel Bot commented May 5, 2026

Copy link
Copy Markdown

@DhineshPonnarasan is attempting to deploy a commit to the shashankss1205's projects Team on Vercel.

A member of the Team first needs to authorize it.

Shashankss1205
Shashankss1205 previously approved these changes May 7, 2026
@Shashankss1205

Copy link
Copy Markdown
Collaborator

Heyy @DhineshPonnarasan can you please fix this PR merge conflicts??
take the '-1' instead of size.

@DhineshPonnarasan

Copy link
Copy Markdown
Contributor Author

Heyy @DhineshPonnarasan can you please fix this PR merge conflicts?? take the '-1' instead of size.

Hiii bro @Shashankss1205 , I had resolved the merge conflicts and applied the requested change to use -1 instead of size. Pushed the fix to this branch. Please take another look.

@Shashankss1205
Shashankss1205 merged commit a9ff1f7 into CodeGraphContext:main May 7, 2026
8 of 9 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog tasks to Done in CGC Progress Board May 7, 2026
macunha1 pushed a commit to macunha1/CodeGraphContext that referenced this pull request Jun 21, 2026
…zu-threadsafe-connection-lock

Fix Kuzu shared-connection race with query lock
@Shashankss1205 Shashankss1205 added gssoc:approved GSSoC validation: counts toward scoring level:advanced GSSoC difficulty: 55 pts contributor / 30 mentor mentor:Shashankss1205 GSSoC mentor attribution: credits reviewing mentor quality:exceptional GSSoC quality: x1.5 contributor / +10 mentor type:bug GSSoC type bonus: bug labels Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC validation: counts toward scoring level:advanced GSSoC difficulty: 55 pts contributor / 30 mentor mentor:Shashankss1205 GSSoC mentor attribution: credits reviewing mentor quality:exceptional GSSoC quality: x1.5 contributor / +10 mentor type:bug GSSoC type bonus: bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug: KùzuDB single Connection shared across concurrent threads causes silent data corruption and non-deterministic crashes

2 participants