Skip to content

Commit 09f7fba

Browse files
iwankgbdims
authored andcommitted
Fixed possible data race
1 parent dcbb1f2 commit 09f7fba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

manager/manager.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,9 +953,12 @@ func (m *manager) createContainerLocked(containerName string, watchSource watche
953953
}
954954

955955
if m.includedMetrics.Has(container.ResctrlMetrics) {
956+
m.machineMu.Lock()
957+
noOfNUMA := len(m.machineInfo.Topology)
958+
m.machineMu.Unlock()
956959
cont.resctrlCollector, err = m.resctrlManager.GetCollector(containerName, func() ([]string, error) {
957960
return cont.getContainerPids(m.inHostNamespace)
958-
}, len(m.machineInfo.Topology))
961+
}, noOfNUMA)
959962
if err != nil {
960963
klog.V(4).Infof("resctrl metrics will not be available for container %s: %s", cont.info.Name, err)
961964
}

0 commit comments

Comments
 (0)