This is an automated email from the ASF dual-hosted git repository.
bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push:
new a5473726f [cgroups2] crash when root folder is not detected when
creating cgroups
a5473726f is described below
commit a5473726f863b151d11b7436676a46a37c3e55f0
Author: None <None>
AuthorDate: Thu May 16 20:35:37 2024 -0400
[cgroups2] crash when root folder is not detected when creating cgroups
Based on this ticket (https://issues.apache.org/jira/browse/MESOS-9305)
and the ROOT_CGROUPS_CreateRecursively test in CgroupsIsolatorTest,
there seems to be a possibility that the root folder may be deleted and
new cgroups cannot be properly created.
In v1, this was addressed by enabling recursively creating the groups.
In v2, since we make use of cgroup.subtree_control to determine a cgroup
and its descendents' access to controllers, we cannot recover this
effectively
if the root folder is deleted, so we cant just recursively create the
folders.
Hence, we elected to crash if the root folder is not found, as it will allow
us to restart and go through the logic that takes care of setting all the
values inside cgroup.subtree_control again.
Review: https://reviews.apache.org/r/74995/
---
src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
b/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
index 6fce8c984..76c8df9b1 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups2/cgroups2.cpp
@@ -163,6 +163,14 @@ Future<Option<ContainerLaunchInfo>>
Cgroups2IsolatorProcess::prepare(
CHECK(containerConfig.container_class() != ContainerClass::DEBUG);
+ // Based on MESOS-9305, there seems to be a possibility that the root
+ // folder may be deleted underneath us. Since we make use of subtree_control
+ // to determine a cgroup and its descendents' access to controllers, we
+ // we can't just recursively create the folders. Hence, we crash if the root
+ // folder is not found, as it will allow us to restart and go through agent's
+ // main logic which sets up the root cgroup and its subtree control.
+ CHECK(cgroups2::exists(flags.cgroups_root));
+
// Create the non-leaf and leaf cgroups for the container, enable
// controllers in the non-leaf cgroup, and `prepare` each of the controllers.
const string nonLeafCgroup = cgroups2_paths::container(