Repository navigation
fix(db): calls inside a WriteTransaction return INT-001 instead of deadlocking (#734) - #739
Merged
Merged
Conversation
…adlocking (#734) checkpoint, verify and rebuild_indexes locked the write lock their own thread's WriteTransaction held, and hung. They now check, as execute, query, fact_log and begin_write do; prepare and PreparedQuery::execute/ query get the same check for consistency. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015NBT2Yx9JUQKYvv2CvC9py
…cked thread Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015NBT2Yx9JUQKYvv2CvC9py
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
# Conflicts: # CLAUDE.md # docs/TEST_COVERAGE.md
# Conflicts: # CLAUDE.md # docs/TEST_COVERAGE.md
This was referenced Oct 24, 2026
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.
Problem (#734)
checkpoint,verifyandrebuild_indexestookinner.write_lockwithout theis_write_tx_active()check thatexecute,query,fact_logandbegin_writemake. Called on a thread that holds aWriteTransaction, each one locked a mutex its own thread already held, and hung.Fix
INT-001check is added tocheckpoint,verify,rebuild_indexes,prepare,PreparedQuery::executeandPreparedQuery::query. The last three could not deadlock, but they ran inside the transaction whereexecute/queryrefuse.is_write_tx_activeis nowpub(crate)soprepared.rscan use it.docs/superpowers/plans/2026-10-24-180-udf-uniffi.md, steps 1–3). Expose UDF registration in every binding #180's re-entry rules depend on these guards.Tests
tests/write_tx_guard_test.rshas one test per method. Each runs on a thread that holds aWriteTransactionon a file database, inside a 30 srecv_timeout, so a deadlock fails the test instead of hanging CI. Each expectsINT-001, then checks that the transaction still commits. A further test checks that the calls still run outside a transaction.Before the fix:
checkpoint,verifyandrebuild_indexestimed out, and the three prepared calls returnedOk.Bench machine: default features 1,710 passed / 13 ignored;
--features test-hooks1,726 / 14 (each +7). One earliertest-hooksrun stopped at a single failure. I didn't capture which test it was, and it didn't reproduce in the--no-fail-fastrerun.cargo clippy --all-features -D warningsis clean.Docs
ERROR_REFERENCE INT-001 (the methods that raise it), CHANGELOG
Fixed, TEST_COVERAGE, CLAUDE.md counts. Amainbackport PR follows. #734 stays open until that v2.x patch is published.🤖 Generated with Claude Code
https://claude.ai/code/session_015NBT2Yx9JUQKYvv2CvC9py