Skip to content

Conversation

@vasild
Copy link
Contributor

@vasild vasild commented Nov 26, 2020

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.

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.
```
It is not modified in the function, so should be `const`.
`HasReason()` is shorter than a lambda function.
@vasild
Copy link
Contributor Author

vasild commented Nov 26, 2020

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"

@jonatack
Copy link
Member

Concept ACK

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Thanks for fixing 👍

@jonasschnelli
Copy link
Contributor

Thanks for fixing!
utACK db058ef

@ajtowns
Copy link
Contributor

ajtowns commented Dec 2, 2020

ACK db058ef

@maflcko maflcko merged commit 7f0f01f into bitcoin:master Dec 2, 2020
Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK db058ef.

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 2, 2020
…le lock is detected

db058ef sync: use HasReason() in double lock tests (Vasil Dimov)
a21dc46 sync: const-qualify the argument of double_lock_detected() (Vasil Dimov)
6d3689f sync: print proper lock order location when double lock is detected (Vasil Dimov)

Pull request description:

  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.
  ```

ACKs for top commit:
  jonasschnelli:
    utACK db058ef
  ajtowns:
    ACK db058ef
  hebasto:
    ACK db058ef, tested on Linux Mint 20 (x86_64).

Tree-SHA512: 452ddb9a14e44bb174135b39f2219c76eadbb8a6c0e80d64a25f995780d6dbc7b570d9902616db94dbfabaee197b5828ba3475171a68240ac0958fb203a7acdb
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants