Page MenuHomePhabricator

[avalanche] Sanitize the thread safety checks in the processor
ClosedPublic

Authored by Fabien on Jan 23 2024, 15:26.

Details

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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable