Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 798F4200D51 for ; Thu, 23 Nov 2017 03:37:10 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 77C22160C0F; Thu, 23 Nov 2017 02:37:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C0C44160BFD for ; Thu, 23 Nov 2017 03:37:09 +0100 (CET) Received: (qmail 3654 invoked by uid 500); 23 Nov 2017 02:37:08 -0000 Mailing-List: contact yarn-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list yarn-issues@hadoop.apache.org Received: (qmail 3643 invoked by uid 99); 23 Nov 2017 02:37:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Nov 2017 02:37:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 0CB111A1B51 for ; Thu, 23 Nov 2017 02:37:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id wabXpgrrvwTi for ; Thu, 23 Nov 2017 02:37:05 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 245145FE22 for ; Thu, 23 Nov 2017 02:37:05 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A01D9E126D for ; Thu, 23 Nov 2017 02:37:02 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 04F6F241AB for ; Thu, 23 Nov 2017 02:37:01 +0000 (UTC) Date: Thu, 23 Nov 2017 02:37:01 +0000 (UTC) From: "Steven Rand (JIRA)" To: yarn-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (YARN-7290) canContainerBePreempted can return true when it shouldn't MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 23 Nov 2017 02:37:10 -0000 [ https://issues.apache.org/jira/browse/YARN-7290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Steven Rand updated YARN-7290: ------------------------------ Attachment: YARN-7290.005.patch Thanks, [~yufeigu]. Attaching a new patch which removes the list of containers, and changes {{resourcesToPreemptByApp}} to a {{Map>}}. Re: the checkstyle issues, one of them no longer applies to the new patch. The other one is that the new {{containersByApp}} variable should be made private and an accessor method should be created for it. I'm happy to do that, but it also would be inconsistent with the other variables in {{PreemptableContainers}}, which aren't private and don't have getters. I don't have a strong opinion, so happy to handle this however people prefer. > canContainerBePreempted can return true when it shouldn't > --------------------------------------------------------- > > Key: YARN-7290 > URL: https://issues.apache.org/jira/browse/YARN-7290 > Project: Hadoop YARN > Issue Type: Bug > Components: fairscheduler > Affects Versions: 3.0.0-beta1 > Reporter: Steven Rand > Assignee: Steven Rand > Attachments: YARN-7290-failing-test.patch, YARN-7290.001.patch, YARN-7290.002.patch, YARN-7290.003.patch, YARN-7290.004.patch, YARN-7290.005.patch > > > In FSAppAttempt#canContainerBePreempted, we make sure that preempting the given container would not put the app below its fair share: > {code} > // Check if the app's allocation will be over its fairshare even > // after preempting this container > Resource usageAfterPreemption = Resources.clone(getResourceUsage()); > // Subtract resources of containers already queued for preemption > synchronized (preemptionVariablesLock) { > Resources.subtractFrom(usageAfterPreemption, resourcesToBePreempted); > } > // Subtract this container's allocation to compute usage after preemption > Resources.subtractFrom( > usageAfterPreemption, container.getAllocatedResource()); > return !isUsageBelowShare(usageAfterPreemption, getFairShare()); > {code} > However, this only considers one container in isolation, and fails to consider containers for the same app that we already added to {{preemptableContainers}} in FSPreemptionThread#identifyContainersToPreemptOnNode. Therefore we can have a case where we preempt multiple containers from the same app, none of which by itself puts the app below fair share, but which cumulatively do so. > I've attached a patch with a test to show this behavior. The flow is: > 1. Initially greedyApp runs in {{root.preemptable.child-1}} and is allocated all the resources (8g and 8vcores) > 2. Then starvingApp runs in {{root.preemptable.child-2}} and requests 2 containers, each of which is 3g and 3vcores in size. At this point both greedyApp and starvingApp have a fair share of 4g (with DRF not in use). > 3. For the first container requested by starvedApp, we (correctly) preempt 3 containers from greedyApp, each of which is 1g and 1vcore. > 4. For the second container requested by starvedApp, we again (this time incorrectly) preempt 3 containers from greedyApp. This puts greedyApp below its fair share, but happens anyway because all six times that we call {{return !isUsageBelowShare(usageAfterPreemption, getFairShare());}}, the value of {{usageAfterPreemption}} is 7g and 7vcores (confirmed using debugger). > So in addition to accounting for {{resourcesToBePreempted}}, we also need to account for containers that we're already planning on preempting in FSPreemptionThread#identifyContainersToPreemptOnNode. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: yarn-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: yarn-issues-help@hadoop.apache.org