Source:
<code>private AllocateResponse sendContainerAskToRM(List<ContainerRequest> containerRequests, List<ContainerRequest> removedContainerRequests, List<ContainerId> releasedContainers) throws YarnException, IOException { if (removedContainerRequests.size() > 0) { LOG.debug("Removing container request: {}", removedContainerRequests); for (ContainerRequest cr : removedContainerRequests) { amRmClient.removeContainerRequest(cr); } } if (containerRequests.size() > 0) { LOG.debug("Asking RM for containers: {}", containerRequests); for (ContainerRequest cr : containerRequests) { amRmClient.addContainerRequest(cr); } } for (ContainerId containerId : releasedContainers) { LOG.info("Released container, id={}", containerId.getId()); amRmClient.releaseAssignedContainer(containerId); } for (String containerIdStr : dnmgr.containerStopRequests.values()) { AllocatedContainer allocatedContainer = this.allocatedContainers.get(containerIdStr); if (allocatedContainer != null && !allocatedContainer.stopRequested) { nmClient.stopContainerAsync(allocatedContainer.container.getId(), allocatedContainer.container.getNodeId()); LOG.info("Requested stop container {}", containerIdStr); allocatedContainer.stopRequested = true; pendingContainersToKill.put(containerIdStr, System.currentTimeMillis()); } dnmgr.containerStopRequests.remove(containerIdStr); } for (Map.Entry<String, Long> pendingToKill : pendingContainersToKill.entrySet()) { if (System.currentTimeMillis() - pendingToKill.getValue() >= REMOVE_CONTAINER_TIMEOUT) { LOG.info("Timeout happened for NodeManager kill container request, recovering the container without waiting", pendingToKill.getKey()); <START> recoverContainer(pendingToKill.getKey()); <END> } } return amRmClient.allocate(0); }</code><technical_language>Is subject ConcurrentModificationException</technical_language>

Target:
private AllocateResponse sendContainerAskToRM(List<ContainerRequest> containerRequests, List<ContainerRequest> removedContainerRequests, List<ContainerId> releasedContainers) throws YarnException, IOException { if (removedContainerRequests.size() > 0) { LOG.debug("Removing container request: {}", removedContainerRequests); for (ContainerRequest cr : removedContainerRequests) { amRmClient.removeContainerRequest(cr); } } if (containerRequests.size() > 0) { LOG.debug("Asking RM for containers: {}", containerRequests); for (ContainerRequest cr : containerRequests) { amRmClient.addContainerRequest(cr); } } for (ContainerId containerId : releasedContainers) { LOG.info("Released container, id={}", containerId.getId()); amRmClient.releaseAssignedContainer(containerId); } for (String containerIdStr : dnmgr.containerStopRequests.values()) { AllocatedContainer allocatedContainer = this.allocatedContainers.get(containerIdStr); if (allocatedContainer != null) { allocatedContainer.stop(nmClient); } dnmgr.containerStopRequests.remove(containerIdStr); } for (Map.Entry<String, AllocatedContainer> entry : allocatedContainers.entrySet()) { if (entry.getValue().checkStopRequestedTimeout()) { LOG.info("Timeout happened for NodeManager kill container request, recovering the container without waiting", entry.getKey()); recoverHelper(entry.getKey()); } } return amRmClient.allocate(0); }