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 62042200D44 for ; Mon, 20 Nov 2017 17:10:07 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 60CDC160BF9; Mon, 20 Nov 2017 16:10:07 +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 A7CC8160BEC for ; Mon, 20 Nov 2017 17:10:06 +0100 (CET) Received: (qmail 75697 invoked by uid 500); 20 Nov 2017 16:10:05 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 75688 invoked by uid 99); 20 Nov 2017 16:10:05 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Nov 2017 16:10:05 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DD668DFD8C; Mon, 20 Nov 2017 16:10:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bibinchundatt@apache.org To: common-commits@hadoop.apache.org Message-Id: <1b9d4693bcba4dac8dcea4626eb496ff@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: hadoop git commit: YARN-7489. ConcurrentModificationException in RMAppImpl#getRMAppMetrics. Contributed by Tao Yang. Date: Mon, 20 Nov 2017 16:10:04 +0000 (UTC) archived-at: Mon, 20 Nov 2017 16:10:07 -0000 Repository: hadoop Updated Branches: refs/heads/branch-2.8 b53d244b7 -> 7e46b770f YARN-7489. ConcurrentModificationException in RMAppImpl#getRMAppMetrics. Contributed by Tao Yang. (cherry picked from commit 5c2986e58dfc86fada8554a3f48cd417a4458abc) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/7e46b770 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/7e46b770 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/7e46b770 Branch: refs/heads/branch-2.8 Commit: 7e46b770f1d6b370629cc08fea4ac699b48f674b Parents: b53d244 Author: bibinchundatt Authored: Mon Nov 20 21:31:50 2017 +0530 Committer: bibinchundatt Committed: Mon Nov 20 21:37:33 2017 +0530 ---------------------------------------------------------------------- .../server/resourcemanager/rmapp/RMAppImpl.java | 39 +++++++++++--------- 1 file changed, 22 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/7e46b770/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java index 357ce5e..f484e87 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java @@ -1468,24 +1468,29 @@ public class RMAppImpl implements RMApp, Recoverable { long vcoreSeconds = 0; long preemptedMemorySeconds = 0; long preemptedVcoreSeconds = 0; - for (RMAppAttempt attempt : attempts.values()) { - if (null != attempt) { - RMAppAttemptMetrics attemptMetrics = - attempt.getRMAppAttemptMetrics(); - Resources.addTo(resourcePreempted, - attemptMetrics.getResourcePreempted()); - numAMContainerPreempted += attemptMetrics.getIsPreempted() ? 1 : 0; - numNonAMContainerPreempted += - attemptMetrics.getNumNonAMContainersPreempted(); - // getAggregateAppResourceUsage() will calculate resource usage stats - // for both running and finished containers. - AggregateAppResourceUsage resUsage = - attempt.getRMAppAttemptMetrics().getAggregateAppResourceUsage(); - memorySeconds += resUsage.getMemorySeconds(); - vcoreSeconds += resUsage.getVcoreSeconds(); - preemptedMemorySeconds += attemptMetrics.getPreemptedMemory(); - preemptedVcoreSeconds += attemptMetrics.getPreemptedVcore(); + this.readLock.lock(); + try { + for (RMAppAttempt attempt : attempts.values()) { + if (null != attempt) { + RMAppAttemptMetrics attemptMetrics = + attempt.getRMAppAttemptMetrics(); + Resources.addTo(resourcePreempted, + attemptMetrics.getResourcePreempted()); + numAMContainerPreempted += attemptMetrics.getIsPreempted() ? 1 : 0; + numNonAMContainerPreempted += + attemptMetrics.getNumNonAMContainersPreempted(); + // getAggregateAppResourceUsage() will calculate resource usage stats + // for both running and finished containers. + AggregateAppResourceUsage resUsage = + attempt.getRMAppAttemptMetrics().getAggregateAppResourceUsage(); + memorySeconds += resUsage.getMemorySeconds(); + vcoreSeconds += resUsage.getVcoreSeconds(); + preemptedMemorySeconds += attemptMetrics.getPreemptedMemory(); + preemptedVcoreSeconds += attemptMetrics.getPreemptedVcore(); + } } + } finally { + this.readLock.unlock(); } return new RMAppMetrics(resourcePreempted, --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org