Index: hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/ResourceSchedulerWrapper.java =================================================================== --- hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/ResourceSchedulerWrapper.java (revision 1531177) +++ hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/ResourceSchedulerWrapper.java (working copy) @@ -201,21 +201,26 @@ List containerIds, List strings, List strings2) { if (metricsON) { - final Timer.Context context = schedulerAllocateTimer.time(); - Allocation allocation = null; + samplerLock.lock(); try { - allocation = scheduler.allocate(attemptId, resourceRequests, - containerIds, strings, strings2); - return allocation; - } finally { - context.stop(); - schedulerAllocateCounter.inc(); + final Timer.Context context = schedulerAllocateTimer.time(); + Allocation allocation = null; try { - updateQueueWithAllocateRequest(allocation, attemptId, - resourceRequests, containerIds); - } catch (IOException e) { - e.printStackTrace(); + allocation = scheduler.allocate(attemptId, resourceRequests, + containerIds, strings, strings2); + return allocation; + } finally { + context.stop(); + schedulerAllocateCounter.inc(); + try { + updateQueueWithAllocateRequest(allocation, attemptId, + resourceRequests, containerIds); + } catch (IOException e) { + LOG.error("updateQueueWithAllocateRequest() encountered error", e); + } } + } finally { + samplerLock.unlock(); } } else { return scheduler.allocate(attemptId,