bitcoin
bitcoin copied to clipboard
Release `LockData::dd_mutex` before calling `*_detected` functions
Both double_lock_detected()
and potential_deadlock_detected()
functions call LogPrintf()
which in turn implies locking of the Logger::m_cs
mutex. To avoid a deadlock, the latter must not have the Mutex
type (see https://github.com/bitcoin/bitcoin/pull/16112).
With this PR the mentioned restriction has been lifted, and it is possible now to use our regular Mutex
type for the Logger::m_cs
mutex instead of a dedicated StdMutex
type (not introducing that change here, as its diff is much bigger than a few lines, and the currently proposed diff seems valuable by itself).
Note for reviewers: Make sure the code is configured and built with CPPFLAGS=-DDEBUG_LOCKORDER
.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Code Coverage
For detailed information about the code coverage, see the test coverage report.
Reviews
See the guideline for information on the review process.
Type | Reviewers |
---|---|
ACK | ryanofsky |
Concept ACK | vasild |
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
There hasn't been much activity lately. What is the status here?
Finding reviewers may take time. However, if the patch is no longer relevant, please close this pull request. If the author lost interest or time to work on this, please close it and mark it 'Up for grabs' with the label, so that it can be picked up in the future.
cc @ryanofsky
Rebased to refresh the CI.
@maflcko @ryanofsky
Do you mind having a look into this PR please?
Sure, seems fine, but I don't see the benefit, if the logger is kept as-is?
@hebasto Are you planning on addressing review feedback here?
I think it would be better if it had another commit getting rid of StdMutex/StdLockGuard. Otherwise nothing is really taking advantage of the change.
I agree. The PR description sounded like this was going to be the ultimate change, but it does not appear to have actually been done.
I re-reviewed this again and retain my ACK because IMO it is an improvement to master
even without further changes because it reduces the scope where the mutex is held. I don't see the fact that it can go further as a blocker for this.
I would be happy to review changing StdMutex m_cs
to Mutex m_cs
here or in another PR.
The PR description sounded like this was going to be the ultimate change
well, fwiw, the description contains "not introducing that change here".