Page MenuHomePhabricator

Fix lock order inversion in promoteStakeContendersToTip
ClosedPublic

Authored by roqqit on Nov 1 2024, 17:39.

Details

Reviewers
Fabien
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Commits
rABC88a5faa04223: Fix lock order inversion in promoteStakeContendersToTip
Summary

Scheduler thread calls:
updatedBlockTip: cs_peerManager -> cs_main
promoteStakeContendersToTip: cs_stakeContendercache -> cs_peerManager

But main thread is calling addStakeContender: cs_main -> cs_stakeContenderCache

Swapping the lock order in promoteStakeContendersToTip fixes TSAN

Test Plan
cmake -GNinja .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DENABLE_SANITIZERS=thread
ninja check-avalanche-processor_tests

Event Timeline

Owners added a reviewer: Restricted Owners Package.Nov 1 2024, 17:39
roqqit published this revision for review.Nov 1 2024, 21:16
roqqit retitled this revision from WIP to Fix lock order inversion in promoteStakeContendersToTip.
roqqit edited the summary of this revision. (Show Details)
roqqit edited the test plan for this revision. (Show Details)
This revision is now accepted and ready to land.Nov 1 2024, 21:59