From ea90cd3556f9f4c53f657266dfbfcc7bd4b031ce Mon Sep 17 00:00:00 2001 From: Peter Bacsko Date: Tue, 9 Mar 2021 12:03:53 +0100 Subject: [PATCH] YARN-10678. Try blocks without catch blocks in SLS scheduler classes can swallow other exceptions. Contributed by Szilard Nemeth. --- .../apache/hadoop/yarn/sls/scheduler/SLSCapacityScheduler.java | 3 +++ .../org/apache/hadoop/yarn/sls/scheduler/SLSFairScheduler.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSCapacityScheduler.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSCapacityScheduler.java index f34a3d3fc6..a3182042f8 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSCapacityScheduler.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSCapacityScheduler.java @@ -119,6 +119,9 @@ public Allocation allocate(ApplicationAttemptId attemptId, containerIds, strings, strings2, updateRequests); return allocation; + } catch (Exception e) { + LOG.error("Caught exception from allocate", e); + throw e; } finally { context.stop(); schedulerMetrics.increaseSchedulerAllocationCounter(); diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSFairScheduler.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSFairScheduler.java index 09ef2cf903..c832436844 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSFairScheduler.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSFairScheduler.java @@ -111,6 +111,9 @@ public Allocation allocate(ApplicationAttemptId attemptId, schedulingRequests, containerIds, blacklistAdditions, blacklistRemovals, updateRequests); return allocation; + } catch (Exception e) { + LOG.error("Caught exception from allocate", e); + throw e; } finally { context.stop(); schedulerMetrics.increaseSchedulerAllocationCounter();