-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Prevent a deadlock in expiration #22374
Conversation
…ding lock, while a revocationJob's OnFailure grabs those lock in the reverse order.
CI Results:
|
Build Results: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a look through this code and I agree with this fix. This should prevent the pending lock being held while the individual lease's lock is being grabbed. In particular, this should prevent a deadlock when a lease is being expired and restored at the same time, as far as I understand it.
There's a chance we haven't gotten to the bottom of this, but based on my understanding, this should either fix the problem or make it much better.
* Prevent a deadlock that occurs when Restore grabs lease lock then pending lock, while a revocationJob's OnFailure grabs those lock in the reverse order. * Fix lock * Add CL * Grab lock before markLeaseIrrevocable --------- Co-authored-by: hc-github-team-secure-vault-core <github-team-secure-vault-core@hashicorp.com>
Deadlock occurs when Restore grabs lease lock then pending lock, while a revocationJob's OnFailure grabs those lock in the reverse order.