Meta-issue: Add Clang thread safety analysis annotations #13129

issue practicalswift opened this issue on April 30, 2018
  1. practicalswift commented at 2:15 PM on April 30, 2018: contributor

    This meta-issue tracks the status of the Clang thread safety analysis PRs.

    • Fix -Wthread-safety-analysis warnings. Compile with -Wthread-safety-analysis if available. (#10866)
    • travis: Build with --enable-werror under OS X (#10923)
    • net: Add missing lock in ProcessHeadersMessage(...) (#11578)
    • addrman: Add missing lock in Clear() (CAddrMan) (#11585)
    • rpc: Lock cs_main in blockToJSON/blockheaderToJSON (#11618)
    • Avoid lock: Call FlushStateToDisk(...) regardless of fCheckForPruning (#11617)
    • tests: Add missing locks to tests (#11623)
    • Add missing cs_wallet/cs_KeyStore locks to wallet (#11634)
    • Add missing locks: validation.cpp + related (#11652)
    • mempool: Fix missing locking in CTxMemPool::check(…) and CTxMemPool::setSanityCheck(…) (#11689)
    • qt: Remove redundant locks (#11733)
    • net: Add missing locks in net.{cpp,h} (#11744)
    • Avoid locking mutexes that are already held by the same thread (#11762)
    • net: Avoid locking cs_vNodes twice when calling FindNode(...). Add NodeExists(...) (#11795)
    • tests: Make test_bitcoin pass under ThreadSanitzer (clang). Fix lock-order-inversion (potential deadlock). (#12882)
    • Add compile time checking for all cs_KeyStore runtime locking assertions (#13077)
    • mempool: Add compile time checking for all ::mempool.cs runtime locking assertions (#13080)
    • wallet: Add compile time checking for all cs_wallet runtime locking assertions (#13081)
    • Add compile time checking for all cs_main runtime locking assertions (#13083)
    • wallet/keystore: Add Clang thread safety annotations for variables guarded by cs_KeyStore (#13114)
    • addrman: Add Clang thread safety annotations for variables guarded by cs_addrMan (#13115)
    • Add Clang thread safety annotations for variables guarded by cs_{rpcWarmup,nTimeOffset,warnings} (#13116)
    • net: Add Clang thread safety annotations for guarded variables in the networking code (#13123)
    • scheduler: Add Clang thread safety annotations for variables guarded by m_cs_callbacks_pending (#13125)
    • util: Add Clang thread safety annotations for variables guarded by cs_args (#13126)
    • wallet: Add Clang thread safety annotations for variables guarded by cs_db (#13127)
    • policy: Add Clang thread safety annotations for variables guarded by cs_feeEstimator (#13128)
    • Move cs_main locking annotations from .cpp to .h (#14063)
    • tests: Add missing locking annotations and locks (g_cs_orphans) (#14108)
    • Add compile time checking for cs_main locks which we assert at run time (#14444)
  2. MarcoFalke added this to the milestone 0.17.0 on Apr 30, 2018
  3. MarcoFalke added the label Refactoring on Apr 30, 2018
  4. practicalswift commented at 2:54 PM on May 5, 2018: contributor

    Update: #13080 has now been merged. Now at 11 of 27 PRs merged! :-)

  5. practicalswift commented at 12:55 PM on May 14, 2018: contributor

    Update: #13116, #13081, #13127 and #11689 have now been merged. Now at 15 of 27 PRs merged! :-)

  6. practicalswift commented at 2:12 PM on May 15, 2018: contributor

    Update: #13125 has now been merged. Now at 16 of 27 PRs merged (59 %) :-)

  7. practicalswift commented at 11:30 PM on July 11, 2018: contributor

    Update: #12882 and #13114 have now been merged. Now at 18 of 27 PRs merged (67 %) :-)

  8. practicalswift commented at 5:56 AM on July 23, 2018: contributor

    Update: #11762 has now been merged. Now at 19 of 27 PRs merged (70 %) :-)

  9. MarcoFalke removed this from the milestone 0.17.0 on Jul 29, 2018
  10. MarcoFalke added this to the milestone 0.18.0 on Jul 29, 2018
  11. practicalswift commented at 8:44 AM on August 1, 2018: contributor

    Update: #11795 has now been closed and #11762 has been merged. Now at 21 of 27 PRs merged (78 %) :-)

  12. practicalswift commented at 12:55 PM on August 30, 2018: contributor

    Update: #13126 has now been merged. Now at 22 of 27 PRs merged (81 %) :-)

  13. practicalswift commented at 2:04 PM on August 30, 2018: contributor

    Good news!

    With 22 of 27 locking annotations PRs merged we're only five PR:s away from 100 % :-)

    These are the five remaining PRs that need review:

    • #11634: "wallet: Add missing cs_wallet/cs_KeyStore locks to wallet"
    • #11652: "Add missing locks: validation.cpp + related"
    • #13115: "addrman: Add Clang thread safety annotations for variables guarded by cs_addrMan"
    • #13123: "net: Add Clang thread safety annotations for guarded variables in the networking code"
    • #13128: "policy: Add Clang thread safety annotations for variables guarded by cs_feeEstimator"

    I'm reaching out to @ajtowns @laanwj @promag @TheBlueMatt - you've all reviewed/commented on one or more of these PRs previously.

    If you have time - please review these five remaining PRs :-)

  14. practicalswift commented at 4:21 AM on October 9, 2018: contributor

    Update: #13115 has now been merged. Now at 23 of 27 PRs merged (85 %) :-)

    These are the four remaining PRs that need review:

    • #11634: "wallet: Add missing cs_wallet/cs_KeyStore locks to wallet"
    • #11652: "Add missing locks: validation.cpp + related"
    • #13123: "net: Add Clang thread safety annotations for guarded variables in the networking code"
    • #13128: "policy: Add Clang thread safety annotations for variables guarded by cs_feeEstimator"

    Getting close to 100 % :-)

  15. laanwj removed this from the milestone 0.18.0 on Feb 13, 2019
  16. MarcoFalke commented at 8:37 PM on February 13, 2019: member

    I think most of this is done. The remaining things have pull requests open.

  17. MarcoFalke closed this on Feb 13, 2019

  18. MarcoFalke locked this on Dec 16, 2021
Linked (view graph)
#10866 Fix -Wthread-safety-analysis warnings. Compile with -Wthread-safety-analysis if available.#10923 travis: Build with --enable-werror under OS X#11578 net: Add missing lock in ProcessHeadersMessage(...)#11585 addrman: Add missing lock in Clear() (CAddrMan)#11617 Avoid lock: Call FlushStateToDisk(...) regardless of fCheckForPruning#11618 rpc: Lock cs_main in blockToJSON/blockheaderToJSON#11623 tests: Add missing locks to tests#11634 wallet: Add missing cs_wallet/cs_KeyStore locks to wallet#11652 Add missing locks: validation.cpp + related#11689 mempool: Fix missing locking in CTxMemPool::check(…) and CTxMemPool::setSanityCheck(…)#11733 qt: Remove redundant locks#11744 net: Add missing locks in net.{cpp,h}#11762 Avoid locking mutexes that are already held by the same thread#11795 net: Avoid locking cs_vNodes twice when calling FindNode(...). Add NodeExists(...).#12882 tests: Make test_bitcoin pass under ThreadSanitzer (clang). Fix lock-order-inversion (potential deadlock).#13077 Add compile time checking for all cs_KeyStore runtime locking assertions#13080 mempool: Add compile time checking for ::mempool.cs runtime locking assertions#13081 wallet: Add compile time checking for cs_wallet runtime locking assertions#13083 Add compile time checking for cs_main runtime locking assertions#13114 wallet/keystore: Add Clang thread safety annotations for variables guarded by cs_KeyStore#13115 addrman: Add Clang thread safety annotations for variables guarded by CAddrMan.cs#13116 Add Clang thread safety annotations for variables guarded by cs_{rpcWarmup,nTimeOffset,warnings}#13123 net: Add Clang thread safety annotations for guarded variables in the networking code#13125 scheduler: Add Clang thread safety annotations for variables guarded by m_cs_callbacks_pending#13126 util: Add Clang thread safety annotations for variables guarded by cs_args#13127 wallet: Add Clang thread safety annotations for variables guarded by cs_db#13128 policy: Add Clang thread safety annotations for variables guarded by cs_feeEstimator#14063 Move cs_main locking annotations from .cpp to .h#14108 tests: Add missing locking annotations and locks (g_cs_orphans)#14444 Add compile time checking for cs_main locks which we assert at run time

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me