Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/4937#discussion_r148569315 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/instance/SlotPool.java --- @@ -361,9 +374,19 @@ private void slotRequestToResourceManagerFailed(AllocationID allocationID, Throw } private void checkTimeoutSlotAllocation(AllocationID allocationID) { + removePendingRequestWithException(allocationID, new TimeoutException("Slot allocation request " + allocationID + " timed out")); + } + + private void removePendingRequestWithException(AllocationID allocationID, Exception e) { PendingRequest request = pendingRequests.remove(allocationID); - if (request != null && !request.getFuture().isDone()) { - request.getFuture().completeExceptionally(new TimeoutException("Slot allocation request timed out")); + if (request != null && (!request.getFuture().isDone() || request.getFuture().isCompletedExceptionally())) { + //TODO: the following line depends on the pr: https://github.com/apache/flink/pull/4887 + //if (resourceManagerGateway != null) { + // resourceManagerGateway.cancelSlotRequest(jobId, jobMasterId, allocationID); + //} --- End diff -- This should be removed and added once #4887 has been merged.
---