Merge pull request #2503 from giuseppe/cgroup-fixes

cgroup, systemd: cleanup cgroups
This commit is contained in:
Mrunal Patel
2020-07-06 15:14:29 -07:00
committed by GitHub
3 changed files with 26 additions and 16 deletions
+8 -1
View File
@@ -222,7 +222,14 @@ func (m *legacyManager) Destroy() error {
return err
}
unitName := getUnitName(m.cgroups)
if err := stopUnit(dbusConnection, unitName); err != nil {
err = stopUnit(dbusConnection, unitName)
// Both on success and on error, cleanup all the cgroups we are aware of.
// Some of them were created directly by Apply() and are not managed by systemd.
if err := cgroups.RemovePaths(m.paths); err != nil {
return err
}
if err != nil {
return err
}
m.paths = make(map[string]string)