sync: print proper lock order location when double lock is detected #20507

pull vasild wants to merge 3 commits into bitcoin:master from vasild:double_lock_print_location changing 2 files +6 −6
  1. vasild commented at 1:45 PM on November 26, 2020: member

    Before:

    Assertion failed: detected double lock at src/sync.cpp:153, details in debug log.
    

    After:

    Assertion failed: detected double lock for 'm' in src/test/sync_tests.cpp:40 (in thread ''), details in debug log.
    
  2. sync: print proper lock order location when double lock is detected
    Before:
    ```
    Assertion failed: detected double lock at src/sync.cpp:153, details in debug log.
    ```
    
    After:
    ```
    Assertion failed: detected double lock for 'm' in src/test/sync_tests.cpp:40 (in thread ''), details in debug log.
    ```
    6d3689fcf6
  3. sync: const-qualify the argument of double_lock_detected()
    It is not modified in the function, so should be `const`.
    a21dc469cc
  4. sync: use HasReason() in double lock tests
    `HasReason()` is shorter than a lambda function.
    db058efeb0
  5. vasild commented at 1:47 PM on November 26, 2020: member

    To force printing of the message:

    --- i/src/test/sync_tests.cpp
    +++ w/src/test/sync_tests.cpp
    @@ -46,5 +46,4 @@ void TestDoubleLock(bool should_throw)
     {
         const bool prev = g_debug_lockorder_abort;
    -    g_debug_lockorder_abort = false;
     
         MutexType m;
    

    and run ./src/test/test_bitcoin --run_test="sync_tests/double_lock_mutex"

  6. jonatack commented at 1:48 PM on November 26, 2020: member

    Concept ACK

  7. DrahtBot added the label Tests on Nov 26, 2020
  8. hebasto approved
  9. hebasto commented at 2:39 PM on November 26, 2020: member

    ACK db058efeb0821cb5022e3b29e0aff3627d7aaf83, tested on Linux Mint 20 (x86_64).

    Thanks for fixing :+1:

  10. jonasschnelli commented at 10:25 AM on December 1, 2020: contributor

    Thanks for fixing! utACK db058efeb0821cb5022e3b29e0aff3627d7aaf83

  11. ajtowns commented at 12:12 AM on December 2, 2020: member

    ACK db058efeb0821cb5022e3b29e0aff3627d7aaf83

  12. MarcoFalke merged this on Dec 2, 2020
  13. MarcoFalke closed this on Dec 2, 2020

  14. promag commented at 9:42 AM on December 2, 2020: member

    Code review ACK db058efeb0821cb5022e3b29e0aff3627d7aaf83.

  15. sidhujag referenced this in commit cba2197182 on Dec 2, 2020
  16. DrahtBot locked this on Feb 15, 2022

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-25 15:15 UTC

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