zhuzhurk commented on a change in pull request #13181:
URL: https://github.com/apache/flink/pull/13181#discussion_r484628806



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/SharedSlot.java
##########
@@ -221,7 +227,14 @@ public void release(Throwable cause) {
                        logicalSlotFuture.thenAccept(logicalSlot -> 
logicalSlot.release(cause));
                }
                requestedLogicalSlots.clear();
-               releaseCallback.accept(executionSlotSharingGroup);
+               releaseExternally();
+       }
+
+       private void releaseExternally() {
+               if (state == State.ALLOCATED && 
requestedLogicalSlots.values().isEmpty()) {
+                       
externalReleaseCallback.accept(executionSlotSharingGroup);
+                       state = State.RELEASED;

Review comment:
       The state needs to be updated before calling `externalReleaseCallback`.
   This is because `SharedSlot#release()` can be triggered in the calling stack.




----------------------------------------------------------------
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]


Reply via email to