Skip to content

Conversation

@hqhq
Copy link
Contributor

@hqhq hqhq commented Nov 19, 2016

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

paths[sys.Name()] = p

if err := sys.Apply(d); err != nil {
m.Paths = paths
Copy link
Member

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?

Copy link
Contributor Author

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.

@hqhq hqhq force-pushed the fix_cgroup_leftover branch from 492603c to 1792693 Compare November 19, 2016 03:51
}

paths := make(map[string]string)
m.Paths = make(map[string]string)

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?

Copy link
Contributor Author

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>
@hqhq hqhq force-pushed the fix_cgroup_leftover branch from 1792693 to 14d58e1 Compare November 22, 2016 01:14
@hqhq
Copy link
Contributor Author

hqhq commented Dec 21, 2016

ping @cyphar @mrunalp @crosbymichael @dqminh

@cyphar
Copy link
Member

cyphar commented Dec 21, 2016

/me will test this right now. This actually will make some of the rootless cgroup manager changes in #774 easier to do.

@cyphar
Copy link
Member

cyphar commented Dec 21, 2016

LGTM.

Approved with PullApprove

@crosbymichael
Copy link
Member

crosbymichael commented Jan 9, 2017

LGTM

Approved with PullApprove

@crosbymichael crosbymichael merged commit 44e60af into opencontainers:master Jan 9, 2017
@hqhq hqhq deleted the fix_cgroup_leftover branch January 10, 2017 01:30
hqhq added a commit to hqhq/runc that referenced this pull request Jan 17, 2017
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>
hqhq added a commit to hqhq/runc that referenced this pull request Jan 17, 2017
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants