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

Deadlock potential #942

Open
JssDWt opened this issue Jul 29, 2024 · 4 comments
Open

Deadlock potential #942

JssDWt opened this issue Jul 29, 2024 · 4 comments
Assignees

Comments

@JssDWt
Copy link
Contributor

JssDWt commented Jul 29, 2024

The importScriptAddress function of ScopedKeyManager takes a Lock on ScopedKeyManager, then a Lock on Manager.

The Address function of Manager takes a RLock on Manager, then a RLock/Lock on ScopedKeyManager.

Combining the two can lead to a deadlock.

@JssDWt
Copy link
Contributor Author

JssDWt commented Jul 29, 2024

There's other occasions too where the locks of manager and scoped manager are reversed. A decision must be made:

  • either always lock manager first, and then scoped manager
  • or always lock scoped manager first and then manager

Probably manager first, then scoped manager makes most sense.
ImportPublicKey and importScriptAddress have this issue

@JssDWt
Copy link
Contributor Author

JssDWt commented Oct 7, 2024

We've been using this, apparently successfully, over the last few months:
breez@04ba108

Let me know if I should PR that.

@guggero
Copy link
Collaborator

guggero commented Oct 7, 2024

Looks like a worthy PR, sure. Thanks for investigating in the first place!

@JssDWt
Copy link
Contributor Author

JssDWt commented Oct 7, 2024

Looks like a worthy PR, sure. Thanks for investigating in the first place!

#942

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants