From 4df79874ffd0f138b7b6a7c7d88b2bf7db8a1d79 Mon Sep 17 00:00:00 2001 From: Bryan Burkholder <771133+bryanlb@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:21:53 -0700 Subject: [PATCH] =?UTF-8?q?Revert=20"Remove=20hardcoded=20timeout=20in=20f?= =?UTF-8?q?avor=20of=20relying=20on=20global=20ZK=20timeout=20(#1=E2=80=A6?= =?UTF-8?q?"=20(#1149)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit d2b61c077407143ef023ef32d96b4da95b546e64. --- .../com/slack/astra/metadata/core/AstraMetadataStore.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/astra/src/main/java/com/slack/astra/metadata/core/AstraMetadataStore.java b/astra/src/main/java/com/slack/astra/metadata/core/AstraMetadataStore.java index 363ab9131a..de9beebb30 100644 --- a/astra/src/main/java/com/slack/astra/metadata/core/AstraMetadataStore.java +++ b/astra/src/main/java/com/slack/astra/metadata/core/AstraMetadataStore.java @@ -214,7 +214,12 @@ public void removeListener(AstraMetadataStoreChangeListener watcher) { private void awaitCacheInitialized() { try { - cacheInitialized.await(); + if (!cacheInitialized.await(30, TimeUnit.SECONDS)) { + // in the event we deadlock, go ahead and time this out at 30s and restart the pod + new RuntimeHalterImpl() + .handleFatal( + new TimeoutException("Timed out waiting for Zookeeper cache to initialize")); + } } catch (InterruptedException e) { new RuntimeHalterImpl().handleFatal(e); }