Skip to content

Commit

Permalink
Fixed possible data race
Browse files Browse the repository at this point in the history
  • Loading branch information
iwankgb committed Dec 20, 2024
1 parent 255cff7 commit 687e382
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 687e382

Please sign in to comment.