Repository navigation
fix core - #155
Merged
Merged
fix core#155
Conversation
…rship A zero-delay retry round (txn_resolved_lock_retry_delay_ms=0) cleared rpcs_/controllers_ while the previous round's issuing loop and rpc callback chains were still on other threads' stacks, freeing objects under them. Recycled same-size allocations let late writes corrupt the new round's controller region_, crashing in Region::IsStale (MDS core). - Add StoreRpcRound<RpcT>: each round's rpcs/controllers/pending are owned by the AsyncCall callbacks via shared_ptr, so a new round can never free state a previous round still uses. - Completion barrier: pending = rpcs + 1; the issuing DoAsync frame releases the extra count after its last task-state access, so the task cannot complete (and be destroyed) under that frame. - Guard region_id_to_resolved_lock_ writes with rw_lock_. - Harden brpc/grpc OnRpcDone: move the callback onto the stack before invoking; nothing may touch rpc members after it runs.
Apply the StoreRpcRound pattern from TxnBatchGetTask to TxnPrewriteTask and TxnCommitTask: per-round rpcs/controllers owned by the AsyncCall callbacks, pending = rpcs + 1 with the extra count released by the issuing DoAsync frame, and every completion path routed through FinishSubTask. This removes the cross-round clear() UAF and stops the task completing (and being destroyed) under a live issuing frame -- the races TSan reported in PrimaryKeyLockConflict and CommitSencondError (including a heap-use-after-free on the callback-owned commit task). Add TSan-verified regression tests for both paths. The full txn suite under TSan now reports 0 issues (was 79). Timer reports in the std::thread actuator are pre-existing, break TSan's happens-before tracking downstream, and are suppressed with a note; they need a separate fix.
chuandew
approved these changes
Jul 20, 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.
No description provided.