diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java index 611a3e5c51..a9a6b6bb91 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java @@ -67,6 +67,7 @@ import org.apache.hadoop.yarn.client.api.async.impl.NMClientAsyncImpl; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.exceptions.InvalidApplicationMasterRequestException; +import org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.ipc.YarnRPC; import org.apache.hadoop.yarn.security.AMRMTokenIdentifier; @@ -115,6 +116,7 @@ import org.apache.slider.providers.SliderProviderFactory; import org.apache.slider.providers.slideram.SliderAMClientProvider; import org.apache.slider.providers.slideram.SliderAMProviderService; +import org.apache.slider.server.appmaster.actions.ActionHalt; import org.apache.slider.server.appmaster.actions.ActionRegisterServiceInstance; import org.apache.slider.server.appmaster.actions.ActionStopSlider; import org.apache.slider.server.appmaster.actions.ActionUpgradeContainers; @@ -1937,7 +1939,21 @@ public float getProgress() { @Override //AMRMClientAsync public void onError(Throwable e) { - LOG_YARN.info("Ignoring AMRMClientAsync.onError() received {}", e); + if (e instanceof InvalidResourceRequestException) { + // stop the cluster + LOG_YARN.error("AMRMClientAsync.onError() received {}", e, e); + signalAMComplete(new ActionStopSlider("stop", EXIT_EXCEPTION_THROWN, + FinalApplicationStatus.FAILED, + "AMRMClientAsync.onError() received " + e)); + } else if (e instanceof InvalidApplicationMasterRequestException) { + // halt the AM + LOG_YARN.error("AMRMClientAsync.onError() received {}", e, e); + queue(new ActionHalt(EXIT_EXCEPTION_THROWN, + "AMRMClientAsync.onError() received " + e)); + } else { + // ignore and log + LOG_YARN.info("Ignoring AMRMClientAsync.onError() received {}", e); + } } /* =================================================================== */ diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionHalt.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionHalt.java index e2ad5597e3..ee1bb72494 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionHalt.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/appmaster/actions/ActionHalt.java @@ -33,6 +33,12 @@ public class ActionHalt extends AsyncAction { private final int status; private final String text; + public ActionHalt( + int status, + String text) { + this(status, text, 0, TimeUnit.MILLISECONDS); + } + public ActionHalt( int status, String text,