-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix leftover cgroup directory issue #1196
Conversation
@@ -148,6 +145,11 @@ func (m *Manager) Apply(pid int) (err error) { | |||
return err | |||
} | |||
paths[sys.Name()] = p | |||
|
|||
if err := sys.Apply(d); err != nil { | |||
m.Paths = paths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to do it this way, where we change m.Paths gradually, why not just change the above paths[sys.Name()]
to m.Paths[sys.Name()]
? Or has that map been used by callers so we have to replace the reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because m.Paths
was initialized as nil
when we create the container, but yes we can initialize m.Paths
and change it directly, I've mended the commit.
492603c
to
1792693
Compare
return cgroups.EnterPid(m.Paths, pid) | ||
} | ||
|
||
paths := make(map[string]string) | ||
m.Paths = make(map[string]string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just put this line of code before the above if
so that the duplicated line inside the above if
can be omitted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks.
In the cases that we got failure on a subsystem's Apply, we'll get some subsystems' cgroup directories leftover. On Docker's point of view, start a container failed, use `docker rm` to remove the container, but some cgroup files are leftover. Sometimes we don't want to clean everyting up when something went wrong, because we need these inter situation information to debug what's going on, but cgroup directories are not useful information we want to keep. Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
1792693
to
14d58e1
Compare
/me will test this right now. This actually will make some of the rootless cgroup manager changes in #774 easier to do. |
In the cases that we got failure on a subsystem's Apply, we'll get some subsystems' cgroup directories leftover. On Docker's point of view, start a container failed, use docker rm to remove the container, but some cgroup files are leftover. Sometimes we don't want to clean everyting up when something went wrong, because we need these inter situation information to debug what's going on, but cgroup directories are not useful information we want to keep. Fixes: http://code.huawei.com/docker/docker/issues/81 Cherry-picked form: opencontainers#1196 Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Fix leftover cgroup directory issue In the cases that we got failure on a subsystem's Apply, we'll get some subsystems' cgroup directories leftover. On Docker's point of view, start a container failed, use docker rm to remove the container, but some cgroup files are leftover. Sometimes we don't want to clean everyting up when something went wrong, because we need these inter situation information to debug what's going on, but cgroup directories are not useful information we want to keep. Fixes: http://code.huawei.com/docker/docker/issues/81 Cherry-picked form: opencontainers#1196 Signed-off-by: Qiang Huang <h.huangqiang@huawei.com> See merge request docker/runc!27
In the cases that we got failure on a subsystem's Apply,
we'll get some subsystems' cgroup directories leftover.
On Docker's point of view, start a container failed, use
docker rm
to remove the container, but some cgroup filesare leftover.
Sometimes we don't want to clean everyting up when something
went wrong, because we need these inter situation
information to debug what's going on, but cgroup directories
are not useful information we want to keep.
Signed-off-by: Qiang Huang h.huangqiang@huawei.com