Skip to content

Commit

Permalink
Fix kubelet panic in cgroup manager.
Browse files Browse the repository at this point in the history
  • Loading branch information
Random-Liu committed Mar 10, 2017
1 parent 486ec2b commit b0f3500
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/kubelet/cm/cgroup_manager_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,16 @@ func (m *cgroupManagerImpl) Pids(name CgroupName) []int {

// WalkFunc which is called for each file and directory in the pod cgroup dir
visitor := func(path string, info os.FileInfo, err error) error {
if err != nil {
glog.V(5).Infof("cgroup manager encountered error scanning cgroup path %q", path)
return filepath.SkipDir
}
if !info.IsDir() {
return nil
}
pids, err = getCgroupProcs(path)
if err != nil {
glog.V(5).Infof("cgroup manager encountered error getting procs for cgroup path %v", path)
glog.V(5).Infof("cgroup manager encountered error getting procs for cgroup path %q", path)
return filepath.SkipDir
}
pidsToKill.Insert(pids...)
Expand All @@ -464,7 +468,7 @@ func (m *cgroupManagerImpl) Pids(name CgroupName) []int {
// container cgroups haven't been GCed yet. Get attached processes to
// all such unwanted containers under the pod cgroup
if err = filepath.Walk(dir, visitor); err != nil {
glog.V(5).Infof("cgroup manager encountered error scanning pids for directory: %v", dir)
glog.V(5).Infof("cgroup manager encountered error scanning pids for directory: %q", dir)
}
}
return pidsToKill.List()
Expand Down

0 comments on commit b0f3500

Please sign in to comment.