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_r404414704 ########## File path: src/linux/cgroups.cpp ########## @@ -696,13 +696,24 @@ Try remove(const string& hierarchy, const string& cgroup) string path = path::join(hierarchy, cgroup); // Do NOT recursively remove cgroups. - Try rmdir = os::rmdir(path, false); - if (rmdir.isError()) { - return Error( + // TODO The retry was added as a fix for kernel bug + // https://lkml.org/lkml/2020/1/15/1349 + // where calling rmdir on a seemingly empty cgroup can fail + // with EBUSY while some tasks are exiting. + auto delay = Milliseconds(1); + for (auto retry = 10; ;) { + Try rmdir = os::rmdir(path, false); + if (!rmdir.isError()) { + return rmdir; + } else if (retry > 0) { + os::sleep(delay); Review comment: @abudnik do you have a suggestion to help this move forward? I've applied my patch to our Mesos build we're using at work, because without it we keep having containers which don't get destroyed, and it leads to a lot of pain because we use gpu isolation and the agent then basically leaks the gpu... As I said earlier I really don't see how to implement the non-blocking retry in a function because we have nowhere to store the variables such as `retry`, `delay`, etc. Can you detail how you would implement it? ---------------------------------------------------------------- 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: users@infra.apache.org With regards, Apache Git Services