client: fix client panic during drain cause by shutdown (#17450)
During shutdown of a client with drain_on_shutdown there is a race between the Client ending the cgroup and the task's cpuset manager cleaning up the cgroup. During the path traversal, skip anything we cannot read, which avoids the nil DirEntry we try to dereference now.
This commit is contained in:
parent
64a4c6204a
commit
134e70cbab
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
client: Fixed a bug where agent would panic during drain incurred by shutdown
|
||||
```
|
|
@ -247,6 +247,11 @@ func (c *cpusetManagerV2) cleanup() {
|
|||
}
|
||||
|
||||
if err := filepath.WalkDir(c.parentAbs, func(path string, entry os.DirEntry, err error) error {
|
||||
// skip anything we cannot read
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// a cgroup is a directory
|
||||
if !entry.IsDir() {
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue