Return-Path: X-Original-To: apmail-ambari-dev-archive@www.apache.org Delivered-To: apmail-ambari-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8102911994 for ; Fri, 29 Aug 2014 10:55:39 +0000 (UTC) Received: (qmail 77933 invoked by uid 500); 29 Aug 2014 10:55:39 -0000 Delivered-To: apmail-ambari-dev-archive@ambari.apache.org Received: (qmail 77901 invoked by uid 500); 29 Aug 2014 10:55:39 -0000 Mailing-List: contact dev-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ambari.apache.org Delivered-To: mailing list dev@ambari.apache.org Received: (qmail 77880 invoked by uid 99); 29 Aug 2014 10:55:38 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Aug 2014 10:55:38 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id 5C8121DD2C0; Fri, 29 Aug 2014 10:55:38 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============3378545658680301061==" MIME-Version: 1.0 Subject: Re: Review Request 25172: ConcurrentModificationException in Resource Comparator From: "Tom Beerbower" To: "John Speidel" , "Sid Wagle" Cc: "Ambari" , "Tom Beerbower" Date: Fri, 29 Aug 2014 10:55:38 -0000 Message-ID: <20140829105538.17468.84554@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org Auto-Submitted: auto-generated Sender: "Tom Beerbower" X-ReviewGroup: Ambari X-ReviewRequest-URL: https://reviews.apache.org/r/25172/ X-Sender: "Tom Beerbower" References: <20140828230305.17468.52116@reviews.apache.org> In-Reply-To: <20140828230305.17468.52116@reviews.apache.org> Reply-To: "Tom Beerbower" X-ReviewRequest-Repository: ambari --===============3378545658680301061== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/25172/ ----------------------------------------------------------- (Updated Aug. 29, 2014, 10:55 a.m.) Review request for Ambari, John Speidel and Sid Wagle. Changes ------- Update patch. Bugs: ambari-7067 https://issues.apache.org/jira/browse/ambari-7067 Repository: ambari Description ------- It looks like that when the JMX property provider times out, we just log the message and bail out of the provider. The query continues but so do the threads trying to acquire the JMX metrics. So the Comparator used at the end of the query gets a ConcurrentModificationException because another thread is still adding properties to the resource. {code} java.util.ConcurrentModificationException at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1100) at java.util.TreeMap$EntryIterator.next(TreeMap.java:1136) at java.util.TreeMap$EntryIterator.next(TreeMap.java:1131) at java.util.AbstractMap.toString(AbstractMap.java:485) at java.lang.String.valueOf(String.java:2826) at java.lang.StringBuilder.append(StringBuilder.java:115) at java.util.AbstractMap.toString(AbstractMap.java:490) at java.lang.String.valueOf(String.java:2826) at java.lang.StringBuilder.append(StringBuilder.java:115) at org.apache.ambari.server.controller.internal.ResourceImpl.toString(ResourceImpl.java:143) at org.apache.ambari.server.controller.internal.ClusterControllerImpl$ResourceComparator.compare(ClusterControllerImpl.java:828) at org.apache.ambari.server.controller.internal.ClusterControllerImpl$ResourceComparator.compare(ClusterControllerImpl.java:773) at org.apache.ambari.server.controller.internal.ClusterControllerImplTest.testComparatorConcurrentModification(ClusterControllerImplTest.java:857) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.junit.runner.JUnitCore.run(JUnitCore.java:157) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) {code} Diffs (updated) ----- ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java b5a5059 ambari-server/src/test/java/org/apache/ambari/server/controller/jmx/JMXPropertyProviderTest.java b4c3c6a Diff: https://reviews.apache.org/r/25172/diff/ Testing ------- Added new unit test. All existing tests pass. Thanks, Tom Beerbower --===============3378545658680301061==--