You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been trying to add cgroupv2 support to coreclr and ran into this assertion. I have a test a program that #includes cgroup.cpp and then calls various cgroup methods in it.
I am running Fedora 31, with cgroupv1 (using systemd.unified_cgroup_hierarchy=0 kernel command line) and podman. This program crashes when run inside a container:
cg: cgroup.cpp:192: static char* CGroup::FindCgroupPath(bool (*)(const char*)): Assertion `cgroup_path_relative_to_mount[common_path_prefix_len] == '/'' failed.
Program received signal SIGABRT, Aborted.
0x00007fb062a41625 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: dnf debuginfo-install libgcc-9.2.1-1.fc31.x86_64 libstdc++-9.2.1-1.fc31.x86_64
(gdb) bt
#0 0x00007fb062a41625 in raise () from /lib64/libc.so.6
#1 0x00007fb062a2a8d9 in abort () from /lib64/libc.so.6
#2 0x00007fb062a2a7a9 in __assert_fail_base.cold () from /lib64/libc.so.6
#3 0x00007fb062a39a66 in __assert_fail () from /lib64/libc.so.6
#4 0x0000000000401a4e in CGroup::FindCgroupPath (is_subsystem=0x4018dc <CGroup::IsMemorySubsystem(char const*)>) at cgroup.cpp:192
#5 0x00000000004015b4 in CGroup::Initialize () at cgroup.cpp:50
#6 0x000000000040126f in InitializeCGroup () at cgroup.cpp:456
#7 0x00000000004014fc in main () at cg.cpp:7
(gdb) frame 4
#4 0x0000000000401a4e in CGroup::FindCgroupPath (is_subsystem=0x4018dc <CGroup::IsMemorySubsystem(char const*)>) at cgroup.cpp:192
192 assert(cgroup_path_relative_to_mount[common_path_prefix_len] == '/');
(gdb) p common_path_prefix_len
$1 = 92
(gdb) p hierarchy_mount
$2 = 0x2031bf0 "/sys/fs/cgroup/memory"
(gdb) p hierarchy_root
$3 = 0x2031e30 "/machine.slice/libpod-8ec162730bf476f53bbbb9406b232f479fee5434c5ae08a939e7dbcd1a7283aa.scope"
(gdb) p cgroup_path_relative_to_mount
$4 = 0x2032100 "/machine.slice/libpod-8ec162730bf476f53bbbb9406b232f479fee5434c5ae08a939e7dbcd1a7283aa.scope"
(gdb) p cgroup_path_relative_to_mount[92]
$5 = 0 '\000'
@omajit I am almost ready to send out a PR for this, the assert was incorrect for unnamed cgroups. It never fired because the cgroups are initialized in the PAL before the debugging support and so the assert was silently ignored.
The fix is exactly what you've said.
I have been trying to add cgroupv2 support to coreclr and ran into this assertion. I have a test a program that
#include
scgroup.cpp
and then calls various cgroup methods in it.I am running Fedora 31, with cgroupv1 (using
systemd.unified_cgroup_hierarchy=0
kernel command line) andpodman
. This program crashes when run inside a container:This seems to have been introduced by #980
Seems to me like the code just expects a trailing slash that's not present:
A fix might be as simple as generalizing the
assert
to handle the case wherecgroup_path_relative_to_mount[common_path_prefix_len]
isNULL
.cc @janvorli
The text was updated successfully, but these errors were encountered: