Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

waddrmgr: fix deadlock #967

Merged
merged 3 commits into from
Nov 27, 2024
Merged

Conversation

aakselrod
Copy link
Contributor

@aakselrod aakselrod commented Nov 25, 2024

This PR fixes a deadlock caused by methods of ScopedManager read-locking the root manager for WatchOnly() and Locked() calls while the ScopedManager itself is locked. This is the reverse order from the normal way of taking locks, but has been hidden by the fact that DB transactions have never happened in parallel until the upcoming postgres changes in LND.

See discussion here for more details.

The first commit updates a test to cause this failure. The following commits, pushed after CI completes/tests fail, contain the fix.

@guggero guggero self-requested a review November 26, 2024 08:53
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Nice find, LGTM 🎉

Copy link
Collaborator

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

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

LGTM👍

@yyforyongyu yyforyongyu merged commit 93c858b into btcsuite:master Nov 27, 2024
3 checks passed
@aakselrod aakselrod deleted the fix-waddrmgr-deadlock branch December 3, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants