Aitozi commented on a change in pull request #17053:
URL: https://github.com/apache/flink/pull/17053#discussion_r699737483
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java
##########
@@ -226,9 +230,21 @@ public static CuratorFramework
startCuratorFramework(Configuration configuration
}
CuratorFramework cf = curatorFrameworkBuilder.build();
-
+ // This handler is only used to handle the error during start phase,
and should be
+ // removed after start curator success.
+ UnhandledErrorListener unhandledErrorListener =
+ (message, throwable) -> {
+ LOG.error(
+ "Exiting process for unhandled error in start
curator framework, "
+ + "error message: {}, exiting code: {}",
+ message,
+ ZOOKEEPER_FAILURE_EXIT_CODE,
+ throwable);
+ System.exit(ZOOKEEPER_FAILURE_EXIT_CODE);
+ };
+ cf.getUnhandledErrorListenable().addListener(unhandledErrorListener);
cf.start();
-
+
cf.getUnhandledErrorListenable().removeListener(unhandledErrorListener);
Review comment:
I used to add this line to avoid affecting other error handler after
`LeaderElectionService` and `LeaderRetrialService` registering handlers.
But I think you are right, error may still happen between `start` and other
handler registered, I will remove this line.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]