cf-natali commented on a change in pull request #355: Handle EBUSY when 
destroying a cgroup.
URL: https://github.com/apache/mesos/pull/355#discussion_r406855188
 
 

 ##########
 File path: src/linux/cgroups.cpp
 ##########
 @@ -263,6 +265,70 @@ static Try<Nothing> cloneCpusetCpusMems(
   return Nothing();
 }
 
+
+// Removes a cgroup from a given hierachy.
+// @param   hierarchy  Path to hierarchy root.
+// @param   cgroup     Path of the cgroup relative to the hierarchy root.
+// @return  Some if the operation succeeds.
+//          Error if the operation fails.
+Future<Nothing> remove(const string& hierarchy, const string& cgroup)
+{
+  const string path = path::join(hierarchy, cgroup);
+
+  // We retry on EBUSY as a workaround for kernel bug
+  // https://lkml.org/lkml/2020/1/15/1349 and others which cause rmdir to fail
+  // with EBUSY even though the cgroup appears empty.
+
+  Duration delay;
+  int retry = 10;
+
+  return loop(
+      [=]() mutable {
+        auto timeout = process::after(delay);
+        delay = (delay == Duration()) ? Milliseconds(1) : delay * 2;
 
 Review comment:
   Done.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to