wangyang0918 commented on a change in pull request #14837: URL: https://github.com/apache/flink/pull/14837#discussion_r571643892
########## File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/highavailability/KubernetesLeaderElectionDriver.java ########## @@ -234,10 +245,21 @@ public void onError(List<KubernetesConfigMap> configMaps) { } @Override - public void handleFatalError(Throwable throwable) { - fatalErrorHandler.onFatalError( - new LeaderElectionException( - "Error while watching the ConfigMap " + configMapName, throwable)); + public void handleError(Throwable throwable) { + if (throwable instanceof KubernetesTooOldResourceVersionException) { + synchronized (watchLock) { + if (running) { + LOG.info("Creating a new watch on ConfigMap {}.", configMapName); + kubernetesWatch = Review comment: I do not think the `kubernetesWatch` closes automatically if an exception occurs since it could handle some exception internally(e.g. network exception). But currently we create a new watch only when the old one is closing with exception. So maybe we do not need to do the duplicated close. ---------------------------------------------------------------- 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