From 687e382745fd081cbf1f959dc41b384dcc53cf1f Mon Sep 17 00:00:00 2001 From: "Maciej \"Iwan\" Iwanowski" Date: Fri, 20 Dec 2024 22:53:19 +0100 Subject: [PATCH] Fixed possible data race --- manager/manager.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manager/manager.go b/manager/manager.go index 8043394d5d..2f7c9ecad3 100644 --- a/manager/manager.go +++ b/manager/manager.go @@ -953,9 +953,12 @@ func (m *manager) createContainerLocked(containerName string, watchSource watche } if m.includedMetrics.Has(container.ResctrlMetrics) { + m.machineMu.Lock() + noOfNUMA := len(m.machineInfo.Topology) + m.machineMu.Unlock() cont.resctrlCollector, err = m.resctrlManager.GetCollector(containerName, func() ([]string, error) { return cont.getContainerPids(m.inHostNamespace) - }, len(m.machineInfo.Topology)) + }, noOfNUMA) if err != nil { klog.V(4).Infof("resctrl metrics will not be available for container %s: %s", cont.info.Name, err) }