From d6d01067a03f75d27c5e88be6f1a41f652eb6e9b Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Mon, 13 Feb 2023 10:26:38 +0100 Subject: [PATCH] fix: allow global leader lock context merge to be canceled (#16603) Global leader lock was first designated to only acquired once until the node is killed. However, currently, the code acquires it repeatedly during the lifetime of the server, now there is a goroutine leak. --- cmd/shared-lock.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/shared-lock.go b/cmd/shared-lock.go index 17f986958..664b68ee3 100644 --- a/cmd/shared-lock.go +++ b/cmd/shared-lock.go @@ -63,6 +63,8 @@ func mergeContext(ctx1, ctx2 context.Context) (context.Context, context.CancelFu select { case <-ctx1.Done(): case <-ctx2.Done(): + // The lock acquirer decides to cancel, exit this goroutine + case <-ctx.Done(): } cancel()