Skip to content
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

[Bug] memory controller missing on ubuntu #2685

Closed
HusterWan opened this issue Jan 23, 2019 · 2 comments · Fixed by #2688 or #2693
Closed

[Bug] memory controller missing on ubuntu #2685

HusterWan opened this issue Jan 23, 2019 · 2 comments · Fixed by #2688 or #2693
Assignees
Labels
kind/bug This is bug report for project os/ubuntu

Comments

@HusterWan
Copy link
Contributor

HusterWan commented Jan 23, 2019

Ⅰ. Issue Description

We have a test case in: https://github.com/alibaba/pouch/blob/master/test/cli_run_cgroup_test.go#L36

This case is to test CgroupParent path, but we got an error on ubuntu:

FAIL: cli_run_cgroup_test.go:36: PouchRunCgroupSuite.TestRunWithCgroupParent
cli_run_cgroup_test.go:38:
    // cgroup-parent relative path
    testRunWithCgroupParent(c, "pouch",
        "TestRunWithRelativePathOfCgroupParent")
cli_run_cgroup_test.go:67:
    c.Fatalf("failed to Stat container %s cgroup mountpoint %s: %v", name, file, err)
... Error: failed to Stat container TestRunWithRelativePathOfCgroupParent cgroup mountpoint /sys/fs/cgroup/memory/pouch/eca63851d772b647efb8491a189e7268196c571e7faefef381ce2fa2215ceb5a/memory.limit_in_bytes: stat /sys/fs/cgroup/memory/pouch/eca63851d772b647efb8491a189e7268196c571e7faefef381ce2fa2215ceb5a/memory.limit_in_bytes: no such file or directory

This bug may relate to: https://stackoverflow.com/questions/15604055/lxc-cgroup-memory-controller-missing

Ⅱ. Describe what happened

Ⅲ. Describe what you expected to happen

Ⅳ. How to reproduce it (as minimally and precisely as possible)

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

  • pouch version (use pouch version):
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:
@pouchrobot pouchrobot added kind/bug This is bug report for project os/ubuntu labels Jan 23, 2019
@Ace-Tang
Copy link
Contributor

Ace-Tang commented Jan 23, 2019

This bug may relate to: https://stackoverflow.com/questions/15604055/lxc-cgroup-memory-controller-missing

From checking runc code, this may not related to the linked url

// GetOwnCgroup returns the relative path to the cgroup docker is running in.
func GetOwnCgroup(subsystem string) (string, error) {
    cgroups, err := ParseCgroupFile("/proc/self/cgroup")
    if err != nil {
        return "", err 
    }   

    return getControllerPath(subsystem, cgroups)
}

in ubuntu 16.04, the /proc/self/cgroup shows like

12:freezer:/
11:pids:/user.slice/user-1000.slice/user@1000.service
10:perf_event:/
9:devices:/user.slice
8:cpuset:/
7:hugetlb:/
6:rdma:/
5:net_cls,net_prio:/
4:blkio:/user.slice
3:memory:/user.slice
2:cpu,cpuacct:/user.slice
1:name=systemd:/user.slice/user-1000.slice/user@1000.service/gnome-terminal-server.service
0::/user.slice/user-1000.slice/user@1000.service/gnome-terminal-server.service

this means we can not get cgroup path like /sys/fs/cgroup + subsystem

fuweid pushed a commit that referenced this issue Jan 24, 2019
runc get cgroup parent through `/proc/self/cgroup`, so can not get cgroup path just
join string like "/sys/fs/cgroup"+"subsystem"+"cgroup-parent"+"containerid", get corrent
cgroup path from `/proc/self/cgroup` in test.

fixes: #2685

Signed-off-by: Ace-Tang <aceapril@126.com>
@Ace-Tang Ace-Tang reopened this Jan 24, 2019
@Ace-Tang
Copy link
Contributor

I make a mistake to find container cgroup path, since when container use cgroup namespace, we can not get cgroup path from container use exec cat proc/self/cgroups. I think the correct way to get container host cgroup path is get from runc

rudyfly pushed a commit that referenced this issue Jan 25, 2019
in ##2688, I make a mistake to find container cgroup path, since when
containeruse cgroup namespace, we can not get cgroup path from container
with`exec cat proc/self/cgroups`. Skip some test if container use cgroup
namespace.

fixes: #2685

Signed-off-by: Ace-Tang <aceapril@126.com>
Ace-Tang added a commit that referenced this issue Mar 12, 2019
runc get cgroup parent through `/proc/self/cgroup`, so can not get cgroup path just
join string like "/sys/fs/cgroup"+"subsystem"+"cgroup-parent"+"containerid", get corrent
cgroup path from `/proc/self/cgroup` in test.

fixes: #2685

Signed-off-by: Ace-Tang <aceapril@126.com>
Ace-Tang added a commit that referenced this issue Mar 12, 2019
in ##2688, I make a mistake to find container cgroup path, since when
containeruse cgroup namespace, we can not get cgroup path from container
with`exec cat proc/self/cgroups`. Skip some test if container use cgroup
namespace.

fixes: #2685

Signed-off-by: Ace-Tang <aceapril@126.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is bug report for project os/ubuntu
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants