HomePhabricator

[avalanche] Sanitize the thread safety checks in the processor

Description

[avalanche] Sanitize the thread safety checks in the processor

Summary:
This diff adds a cs_main runtime check to the proof isWorthPolling variant. The addToReconcile (and in turn the isWorthPolling visitor that it calls) is critical to get thread safe and avoid lock ordering issues as it is called from various threads (sceduler, net, ...).
Unfortunately clang thread safety annotation does not play well with std::variants as it assumes all the variants are reachable, making it complicated and inefficient to maintain the annotations.
As a consequence this diff also removes some annotations from addToReconcile and co. which are arleady present at the variant level and caught by the debug builds or tsan.

Test Plan:
With Clang and Debug:

ninja all check

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D15249

Details

Provenance
FabienAuthored on Jan 23 2024, 15:20
FabienPushed on Jan 24 2024, 08:44
Reviewer
Restricted Project
Differential Revision
D15249: [avalanche] Sanitize the thread safety checks in the processor
Parents
rABCeff4b61de9b2: [Cashtab] Move dev dependencies to dev dependencies
Branches
Unknown
Tags
Unknown