From reviews-return-91594-apmail-mesos-reviews-archive=mesos.apache.org@mesos.apache.org Sun Apr 12 08:08:50 2020 Return-Path: X-Original-To: apmail-mesos-reviews-archive@minotaur.apache.org Delivered-To: apmail-mesos-reviews-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by minotaur.apache.org (Postfix) with SMTP id 19E4D19FCF for ; Sun, 12 Apr 2020 08:08:49 +0000 (UTC) Received: (qmail 59532 invoked by uid 500); 12 Apr 2020 08:08:49 -0000 Delivered-To: apmail-mesos-reviews-archive@mesos.apache.org Received: (qmail 59477 invoked by uid 500); 12 Apr 2020 08:08:49 -0000 Mailing-List: contact reviews-help@mesos.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: reviews@mesos.apache.org Delivered-To: mailing list reviews@mesos.apache.org Received: (qmail 59464 invoked by uid 99); 12 Apr 2020 08:08:48 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Apr 2020 08:08:48 +0000 From: GitBox To: reviews@mesos.apache.org Subject: [GitHub] [mesos] cf-natali commented on a change in pull request #355: Handle EBUSY when destroying a cgroup. Message-ID: <158667892875.20443.3393546002511336768.gitbox@gitbox.apache.org> References: In-Reply-To: Date: Sun, 12 Apr 2020 08:08:48 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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_r407163471 ########## File path: src/linux/cgroups.cpp ########## @@ -263,6 +265,73 @@ static Try 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 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 = Duration::zero(); + int retry = 10; + + return loop( + [=]() mutable { + auto timeout = process::after(delay); + delay = (delay == Duration::zero()) ? Milliseconds(1) : delay * 2; + return timeout; Review comment: But it would mean that we always introduce a 1ms delay before trying to remove the cgroup. It's not much, but it'd be best to avoid 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