Repository navigation
Report a poisoned lock where it was taken, and stop converting PoisonError publicly - #1641
Merged
Merged
Conversation
…Error publicly StorageError and Error converted a PoisonError into LockPoisoned through public From impls, which recorded Location::caller() without #[track_caller], so every poisoned lock was reported at the same line inside error.rs. Being public, they also let a caller convert its own poisoned lock into a redb error that blames redb. redb's lock sites now convert through a crate-private helper that records where the lock was taken. Under experimental-api-5 the public impls are removed; without it they remain, now with #[track_caller]. Assisted-by: Claude Code Claude-Session: https://claude.ai/code/session_01ALhxet6NP69dCfAUv8TAhR
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
StorageErrorandErrorimplementedFrom<PoisonError<T>>publicly, so that redb's own code could writeself.state.lock()?. That has two problems:LockPoisonedrecordsLocation::caller(), butfromwasn't#[track_caller], so every poisoned lock was reported at the same line insideerror.rs.redb::Errorcan?its own poisonedMutexintoError::LockPoisoned, whose message says "Poisoned internal lock".Changes:
page_manager,transaction_tracker,base,table_tree) now use a crate-privateLockResultExt::or_poisoned(). It's#[track_caller], soLockPoisonedpoints at the line that took the lock.experimental-api-5, the publicFrom<PoisonError<T>>impls are removed.#[track_caller], so 4.x callers also get the right location.lock_poisoned_reports_the_lock_sitepoisons a mutex and checks the reported file and line. I confirmed it fails without#[track_caller]: it reports the helper's own line.Checked:
cargo fmt.--all --all-targets, with and without--all-features.cargo test --all-features, andcargo testwith default features.Generated by Claude Code