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

Prevent a deadlock in expiration #22374

Merged
merged 4 commits into from Aug 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion vault/expiration.go
Expand Up @@ -240,12 +240,12 @@ 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.pendingLock.Lock()
defer r.m.pendingLock.Unlock()
pendingRaw, ok := r.m.pending.Load(r.leaseID)
if !ok {
r.m.logger.Warn("failed to find lease in pending map for revocation retry", "lease_id", r.leaseID)
return
ncabatoff marked this conversation as resolved.
Show resolved Hide resolved
}
r.m.pendingLock.Unlock()

pending := pendingRaw.(pendingInfo)
pending.revokesAttempted++
Expand Down Expand Up @@ -277,7 +277,9 @@ func (r *revocationJob) OnFailure(err error) {
}

pending.timer.Reset(newTimer)
r.m.pendingLock.Lock()
r.m.pending.Store(r.leaseID, pending)
r.m.pendingLock.Unlock()
}

func expireLeaseStrategyFairsharing(ctx context.Context, m *ExpirationManager, leaseID string, ns *namespace.Namespace) {
Expand Down