You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by ni...@apache.org on 2022/09/14 20:10:08 UTC

[bookkeeper] branch master updated: AutoRecovery - Do not call shutdown() on the main ZookKeeper client thread (#3487)

This is an automated email from the ASF dual-hosted git repository.

nicoloboschi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 6fc2e08d53 AutoRecovery - Do not call shutdown() on the main ZookKeeper client thread (#3487)
6fc2e08d53 is described below

commit 6fc2e08d534159fc078022a6781e94933b7268d1
Author: Enrico Olivelli <eo...@apache.org>
AuthorDate: Wed Sep 14 22:09:57 2022 +0200

    AutoRecovery - Do not call shutdown() on the main ZookKeeper client thread (#3487)
---
 .../java/org/apache/bookkeeper/replication/AutoRecoveryMain.java   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AutoRecoveryMain.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AutoRecoveryMain.java
index 1e12a53993..861c3b136d 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AutoRecoveryMain.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AutoRecoveryMain.java
@@ -28,6 +28,7 @@ import java.io.File;
 import java.io.IOException;
 import java.lang.Thread.UncaughtExceptionHandler;
 import java.net.MalformedURLException;
+import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
 import org.apache.bookkeeper.bookie.BookieCriticalThread;
 import org.apache.bookkeeper.bookie.BookieImpl;
@@ -94,7 +95,11 @@ public class AutoRecoveryMain {
         MetadataClientDriver metadataClientDriver = bkc.getMetadataClientDriver();
         metadataClientDriver.setSessionStateListener(() -> {
             LOG.error("Client connection to the Metadata server has expired, so shutting down AutoRecoveryMain!");
-            shutdown(ExitCode.ZK_EXPIRED);
+            // do not run "shutdown" in the main ZooKeeper client thread
+            // as it performs some blocking operations
+            CompletableFuture.runAsync(() -> {
+                shutdown(ExitCode.ZK_EXPIRED);
+            });
         });
 
         auditorElector = new AuditorElector(