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:
Seth Hoenig 2023-06-07 15:12:44 -05:00 committed by GitHub
parent 64a4c6204a
commit 134e70cbab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

3
.changelog/17450.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
client: Fixed a bug where agent would panic during drain incurred by shutdown
```

View File

@ -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