azagrebin commented on a change in pull request #13511:
URL: https://github.com/apache/flink/pull/13511#discussion_r497493414
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/SharedSlot.java
##########
@@ -215,10 +218,19 @@ public void release(Throwable cause) {
slotContextFuture.isDone(),
"Releasing of the shared slot is expected only from its
successfully allocated physical slot ({})",
physicalSlotRequestId);
- for (ExecutionVertexID executionVertexId :
requestedLogicalSlots.keySetA()) {
- LOG.debug("Release {}",
getLogicalSlotString(executionVertexId));
+ LOG.debug("Release shared slot ({})", physicalSlotRequestId);
+
+ // copy the logical slot collection to avoid
ConcurrentModificationException
+ // if logical slot releases cause cancellation of other
executions
+ // which will try to call returnLogicalSlot and modify
requestedLogicalSlots collection
+ Map<ExecutionVertexID, CompletableFuture<SingleLogicalSlot>>
logicalSlotFutures = requestedLogicalSlots
+ .keySetA()
+ .stream()
+ .collect(Collectors.toMap(executionVertexId ->
executionVertexId, requestedLogicalSlots::getValueByKeyA));
Review comment:
True, it would be computationally cheaper but I would prefer to keep the
full logging statement with all ids.
I do not think that the slot will be shared by unreasonably high number of
executions.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]