cgroup, systemd: cleanup cgroups #2503
Conversation
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
|
lgtm |
AkihiroSuda
left a comment
There was a problem hiding this comment.
LGTM, but I'd like to see integration tests if possible
|
@AkihiroSuda is the CI failure a flake? |
Could you try restarting CI? If the error persists, |
|
I was too naive to think lstat(2) is a cheap syscall, and so I wrote a benchmark for func BenchmarkIsRunningSystemd(b *testing.B) {
var res bool
for i := 0; i < b.N; i++ {
res = IsRunningSystemd()
}
b.Logf("IsRunningSystemd: %v", res)
}Before this PR: After: Out of pure curiosity I also tried using func IsRunningSystemd() bool {
var st unix.Stat_t
err := unix.Lstat("/run/systemd/system", &st)
if err != nil {
return false
}
return st.Mode&unix.S_IFDIR == unix.S_IFDIR
}and the result is roughly 20% savings: So, yes, using |
|
CI failure is a glitch (or we should not rely on github to provide CI restarted |
|
Alas, the test case is not catching the bug (I have reverted the fixing part): $ git show libcontainer/cgroups/systemd/v1.go | patch -p1 -R
patching file libcontainer/cgroups/systemd/v1.go
$ sudo make localintegration TESTPATH=/delete.bats
[sudo] password for kir:
go build "-mod=vendor" "-buildmode=pie" -tags "seccomp selinux apparmor" -ldflags "-X main.gitCommit="2185e9c4aa7b3e91b14e1073176ec3ee296ff665-dirty" -X main.version=1.0.0-rc91+dev " -o runc .
go build "-mod=vendor" "-buildmode=pie" -tags "seccomp selinux apparmor" -ldflags "-X main.gitCommit="2185e9c4aa7b3e91b14e1073176ec3ee296ff665-dirty" -X main.version=1.0.0-rc91+dev " -o contrib/cmd/recvtty/recvtty ./contrib/cmd/recvtty
bats -t tests/integration/delete.bats
1..4
ok 1 runc delete
ok 2 runc delete --force
ok 3 runc delete --force ignore not exist
ok 4 runc delete --force in cgroupv2 with subcgroups # skip test requires cgroups_v2 |
are you using |
Oh, I forgot Yes, the test is working |
some hierarchies were created directly by .Apply() on top of systemd managed cgroups. systemd doesn't manage these and as a result we leak these cgroups. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
some hierarchies were created directly by .Apply() on top of systemd managed cgroups. systemd doesn't manage these and as a result we leak these cgroups.
Signed-off-by: Giuseppe Scrivano gscrivan@redhat.com