Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Fix wrong assert in cgroups code (#34291)
Browse files Browse the repository at this point in the history
There is an assert in FindCgroupPath that fires when hierarchy_root
and cgroup_path_relative_to_mount are equal, which is the case for
cgroups that are not named. This assert checks that the common
path in those two variables ends with / which is only the case
with named groups.

We have never seen this assert to fire because cgroups initialization
happens before the debugger support initialization in PAL and so
asserts are disabled at that point. I am going to fix that in a
separate PR.

This problem was discovered with the standalone GC where the assert
actually fires as it uses a plain C assert function.

This change fixes the assert to account for the case when both the
paths are the same.
  • Loading branch information
janvorli authored and jkotas committed Apr 1, 2020
1 parent 83758cb commit 17369d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Native/gc/unix/cgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class CGroup
common_path_prefix_len = 0;
}

assert(cgroup_path_relative_to_mount[common_path_prefix_len] == '/');
assert((cgroup_path_relative_to_mount[common_path_prefix_len] == '/') || (cgroup_path_relative_to_mount[common_path_prefix_len] == '\0'));

strcat(cgroup_path, cgroup_path_relative_to_mount + common_path_prefix_len);

Expand Down

0 comments on commit 17369d3

Please sign in to comment.