From 68750347f2e99f420608bdb76cff5ea4cd9dac14 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Thu, 14 Mar 2024 15:39:10 +0200 Subject: [PATCH] nfd-master: fix memory leak in nfd api-controller Fixes a memory leak that happened when stopping (and then re-starting) the nfd api controller. The stop channel was not used properly which caused the underlying informer to keep on running. --- pkg/nfd-master/nfd-api-controller.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/nfd-master/nfd-api-controller.go b/pkg/nfd-master/nfd-api-controller.go index 00c606eee..b1d734c75 100644 --- a/pkg/nfd-master/nfd-api-controller.go +++ b/pkg/nfd-master/nfd-api-controller.go @@ -123,10 +123,7 @@ func newNfdController(config *restclient.Config, nfdApiControllerOptions nfdApiC } func (c *nfdController) stop() { - select { - case c.stopChan <- struct{}{}: - default: - } + close(c.stopChan) } func (c *nfdController) updateOneNode(typ string, obj metav1.Object) {