xintongsong commented on a change in pull request #11323: URL: https://github.com/apache/flink/pull/11323#discussion_r412626933
########## File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/KubernetesResourceManager.java ########## @@ -320,5 +333,16 @@ private void internalStopPod(String podName) { } } ); + + final KubernetesWorkerNode kubernetesWorkerNode = workerNodes.remove(resourceId); + final WorkerResourceSpec workerResourceSpec = podWorkerResources.remove(podName); + + // If the stopped pod is requested in the current attempt (workerResourceSpec is known) and is not yet added, + // we need to notify ActiveResourceManager to decrease the pending worker count. + if (workerResourceSpec != null && kubernetesWorkerNode == null) { Review comment: I think we don't want to call `notifyNewWorkerAllocationFailed` and decrease the pending count when a recovered pod is being stopped. The `pendingWorkerCounter` only accounts for the workers requested in the current attempt. ---------------------------------------------------------------- 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: us...@infra.apache.org