From reviews-return-91573-apmail-mesos-reviews-archive=mesos.apache.org@mesos.apache.org Fri Apr 10 13:40:23 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 9CEA8196C0 for ; Fri, 10 Apr 2020 13:40:21 +0000 (UTC) Received: (qmail 10504 invoked by uid 500); 10 Apr 2020 13:40:21 -0000 Delivered-To: apmail-mesos-reviews-archive@mesos.apache.org Received: (qmail 10476 invoked by uid 500); 10 Apr 2020 13:40:21 -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 10425 invoked by uid 99); 10 Apr 2020 13:40:21 -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; Fri, 10 Apr 2020 13:40:21 +0000 From: GitBox To: reviews@mesos.apache.org Subject: [GitHub] [mesos] qianzhangxa commented on a change in pull request #355: Handle EBUSY when destroying a cgroup. Message-ID: <158652602100.31706.6514611592808433949.gitbox@gitbox.apache.org> References: In-Reply-To: Date: Fri, 10 Apr 2020 13:40:21 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit qianzhangxa commented on a change in pull request #355: Handle EBUSY when destroying a cgroup. URL: https://github.com/apache/mesos/pull/355#discussion_r406744824 ########## File path: src/linux/cgroups.cpp ########## @@ -263,6 +265,70 @@ 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; + int retry = 10; + + return loop( + [=]() mutable { + auto timeout = process::after(delay); + delay = (delay == Duration()) ? Milliseconds(1) : delay * 2; Review comment: Can we use `Duration::zero()` instead of `Duration()`? ---------------------------------------------------------------- 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