This is an automated email from the ASF dual-hosted git repository.
nicoloboschi pushed a commit to branch branch-4.15
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/branch-4.15 by this push:
new f0182edbfb AutoRecovery - Do not call shutdown() on the main
ZookKeeper client thread (#3487)
f0182edbfb is described below
commit f0182edbfb8308ed85bccdb399aa4a3290633564
Author: Enrico Olivelli <[email protected]>
AuthorDate: Wed Sep 14 22:09:57 2022 +0200
AutoRecovery - Do not call shutdown() on the main ZookKeeper client thread
(#3487)
(cherry picked from commit 6fc2e08d534159fc078022a6781e94933b7268d1)
---
.../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 0f2b2c009a..ded02b59d3 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
@@ -27,6 +27,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;
@@ -93,7 +94,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(