mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-19 08:40:42 +00:00
cpu manager policy set to none, no one remove container id from container map, lead memory leak
This commit is contained in:
parent
1ea07d482a
commit
fb3636da40
@ -69,3 +69,10 @@ func (cm ContainerMap) GetContainerRef(containerID string) (string, string, erro
|
||||
}
|
||||
return cm[containerID].podUID, cm[containerID].containerName, nil
|
||||
}
|
||||
|
||||
// Visit invoke visitor function to walks all of the entries in the container map
|
||||
func (cm ContainerMap) Visit(visitor func(podUID, containerName, containerID string)) {
|
||||
for k, v := range cm {
|
||||
visitor(v.podUID, v.containerName, k)
|
||||
}
|
||||
}
|
||||
|
@ -388,6 +388,16 @@ func (m *manager) removeStaleState() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m.containerMap.Visit(func(podUID, containerName, containerID string) {
|
||||
if _, ok := activeContainers[podUID][containerName]; !ok {
|
||||
klog.ErrorS(nil, "RemoveStaleState: removing container", "podUID", podUID, "containerName", containerName)
|
||||
err := m.policyRemoveContainerByRef(podUID, containerName)
|
||||
if err != nil {
|
||||
klog.ErrorS(err, "RemoveStaleState: failed to remove container", "podUID", podUID, "containerName", containerName)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (m *manager) reconcileState() (success []reconciledContainer, failure []reconciledContainer) {
|
||||
|
@ -339,6 +339,13 @@ func (m *manager) removeStaleState() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m.containerMap.Visit(func(podUID, containerName, containerID string) {
|
||||
if _, ok := activeContainers[podUID][containerName]; !ok {
|
||||
klog.InfoS("RemoveStaleState removing state", "podUID", podUID, "containerName", containerName)
|
||||
m.policyRemoveContainerByRef(podUID, containerName)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (m *manager) policyRemoveContainerByRef(podUID string, containerName string) {
|
||||
|
Loading…
Reference in New Issue
Block a user