From 493a143b980ba207db7c359c8fe00156491142b9 Mon Sep 17 00:00:00 2001 From: Brian Kassouf Date: Wed, 27 Oct 2021 09:08:10 -0700 Subject: [PATCH] Fix leak of restore worker go routines after an error (#12933) --- vault/expiration.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vault/expiration.go b/vault/expiration.go index 403ac8434423..d5574a101e77 100644 --- a/vault/expiration.go +++ b/vault/expiration.go @@ -668,8 +668,8 @@ func (m *ExpirationManager) Restore(errorFunc func()) (retErr error) { broker := make(chan *lease) quit := make(chan bool) // Buffer these channels to prevent deadlocks - errs := make(chan error, len(existing)) - result := make(chan struct{}, len(existing)) + errs := make(chan error, leaseCount) + result := make(chan struct{}, leaseCount) // Use a wait group wg := &sync.WaitGroup{}