mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 02:02:43 +00:00
backport of commit abaf1d6874 (#22378)
This commit is contained in:
committed by
GitHub
parent
702c80d279
commit
bcd2db3bc3
3
changelog/22374.txt
Normal file
3
changelog/22374.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
```release-note:bug
|
||||||
|
expiration: Fix a deadlock that could occur when a revocation failure happens while restoring leases on startup.
|
||||||
|
```
|
||||||
@@ -237,8 +237,8 @@ func (r *revocationJob) OnFailure(err error) {
|
|||||||
r.m.core.metricSink.IncrCounterWithLabels([]string{"expire", "lease_expiration", "error"}, 1, []metrics.Label{metricsutil.NamespaceLabel(r.ns)})
|
r.m.core.metricSink.IncrCounterWithLabels([]string{"expire", "lease_expiration", "error"}, 1, []metrics.Label{metricsutil.NamespaceLabel(r.ns)})
|
||||||
|
|
||||||
r.m.pendingLock.Lock()
|
r.m.pendingLock.Lock()
|
||||||
defer r.m.pendingLock.Unlock()
|
|
||||||
pendingRaw, ok := r.m.pending.Load(r.leaseID)
|
pendingRaw, ok := r.m.pending.Load(r.leaseID)
|
||||||
|
r.m.pendingLock.Unlock()
|
||||||
if !ok {
|
if !ok {
|
||||||
r.m.logger.Warn("failed to find lease in pending map for revocation retry", "lease_id", r.leaseID)
|
r.m.logger.Warn("failed to find lease in pending map for revocation retry", "lease_id", r.leaseID)
|
||||||
return
|
return
|
||||||
@@ -266,7 +266,9 @@ func (r *revocationJob) OnFailure(err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r.m.pendingLock.Lock()
|
||||||
r.m.markLeaseIrrevocable(r.nsCtx, le, err)
|
r.m.markLeaseIrrevocable(r.nsCtx, le, err)
|
||||||
|
r.m.pendingLock.Unlock()
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
r.m.logger.Error("failed to revoke lease", "lease_id", r.leaseID, "error", err,
|
r.m.logger.Error("failed to revoke lease", "lease_id", r.leaseID, "error", err,
|
||||||
@@ -274,7 +276,9 @@ func (r *revocationJob) OnFailure(err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pending.timer.Reset(newTimer)
|
pending.timer.Reset(newTimer)
|
||||||
|
r.m.pendingLock.Lock()
|
||||||
r.m.pending.Store(r.leaseID, pending)
|
r.m.pending.Store(r.leaseID, pending)
|
||||||
|
r.m.pendingLock.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func expireLeaseStrategyFairsharing(ctx context.Context, m *ExpirationManager, leaseID string, ns *namespace.Namespace) {
|
func expireLeaseStrategyFairsharing(ctx context.Context, m *ExpirationManager, leaseID string, ns *namespace.Namespace) {
|
||||||
|
|||||||
Reference in New Issue
Block a user