diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 29393733fd5..12cf92519e6 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -496,6 +496,9 @@ Release 2.7.1 - UNRELEASED YARN-3694. Fix dead link for TimelineServer REST API. (Jagadesh Kiran N via aajisaka) + YARN-3646. Applications are getting stuck some times in case of retry + policy forever. (Raju Bairishetti via devaraj) + Release 2.7.0 - 2015-04-20 INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java index 511fa4acb39..bc40b9ae6c9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java @@ -1265,4 +1265,36 @@ public class TestYarnClient { ReservationSystemTestUtil.reservationQ); return request; } + + @Test(timeout = 30000, expected = ApplicationNotFoundException.class) + public void testShouldNotRetryForeverForNonNetworkExceptions() throws Exception { + YarnConfiguration conf = new YarnConfiguration(); + conf.setInt(YarnConfiguration.RESOURCEMANAGER_CONNECT_MAX_WAIT_MS, -1); + + ResourceManager rm = null; + YarnClient yarnClient = null; + try { + // start rm + rm = new ResourceManager(); + rm.init(conf); + rm.start(); + + yarnClient = YarnClient.createYarnClient(); + yarnClient.init(conf); + yarnClient.start(); + + // create invalid application id + ApplicationId appId = ApplicationId.newInstance(1430126768L, 10645); + + // RM should throw ApplicationNotFoundException exception + yarnClient.getApplicationReport(appId); + } finally { + if (yarnClient != null) { + yarnClient.stop(); + } + if (rm != null) { + rm.stop(); + } + } + } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/RMProxy.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/RMProxy.java index fa8d6423066..28628f32a47 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/RMProxy.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/RMProxy.java @@ -224,19 +224,20 @@ public class RMProxy { failoverSleepBaseMs, failoverSleepMaxMs); } - if (waitForEver) { - return RetryPolicies.RETRY_FOREVER; - } - if (rmConnectionRetryIntervalMS < 0) { throw new YarnRuntimeException("Invalid Configuration. " + YarnConfiguration.RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS + " should not be negative."); } - RetryPolicy retryPolicy = - RetryPolicies.retryUpToMaximumTimeWithFixedSleep(rmConnectWaitMS, - rmConnectionRetryIntervalMS, TimeUnit.MILLISECONDS); + RetryPolicy retryPolicy = null; + if (waitForEver) { + retryPolicy = RetryPolicies.RETRY_FOREVER; + } else { + retryPolicy = + RetryPolicies.retryUpToMaximumTimeWithFixedSleep(rmConnectWaitMS, + rmConnectionRetryIntervalMS, TimeUnit.MILLISECONDS); + } Map, RetryPolicy> exceptionToPolicyMap = new HashMap, RetryPolicy>();