From 1a37dfdcd17b3ff6078600734c8f61c4fa496291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20H=C3=B6sler?= Date: Fri, 10 Aug 2018 06:47:42 +0200 Subject: [PATCH] Fetch unhandled curator exceptions (#6131) * fix: stop druid on unhandled curator exceptions * catch exceptions when stopping lifecycle --- .../src/main/java/io/druid/curator/CuratorModule.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/src/main/java/io/druid/curator/CuratorModule.java b/server/src/main/java/io/druid/curator/CuratorModule.java index bc1ec986551..163ae73c371 100644 --- a/server/src/main/java/io/druid/curator/CuratorModule.java +++ b/server/src/main/java/io/druid/curator/CuratorModule.java @@ -91,6 +91,16 @@ public class CuratorModule implements Module .aclProvider(config.getEnableAcl() ? new SecuredACLProvider() : new DefaultACLProvider()) .build(); + framework.getUnhandledErrorListenable().addListener((message, e) -> { + log.error(e, "Unhandled error in Curator Framework"); + try { + lifecycle.stop(); + } + catch (Throwable t) { + log.warn(t, "Exception when stopping druid lifecycle"); + } + }); + lifecycle.addHandler( new Lifecycle.Handler() {