You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ap...@apache.org on 2025/06/25 17:14:24 UTC

(phoenix) branch master updated: PHOENIX-7645 HighAvailabilityGroup can leak zookeeper connections (#2200)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 03f99d77fc PHOENIX-7645 HighAvailabilityGroup can leak zookeeper connections (#2200)
03f99d77fc is described below

commit 03f99d77fcf38f6398e49e8405670d3aa2a8557b
Author: Andrew Purtell <ap...@apache.org>
AuthorDate: Wed Jun 25 10:14:19 2025 -0700

    PHOENIX-7645 HighAvailabilityGroup can leak zookeeper connections (#2200)
---
 .../apache/phoenix/jdbc/HighAvailabilityGroup.java    | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/HighAvailabilityGroup.java b/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/HighAvailabilityGroup.java
index c00e533dac..9b704973c4 100644
--- a/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/HighAvailabilityGroup.java
+++ b/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/HighAvailabilityGroup.java
@@ -438,10 +438,21 @@ public class HighAvailabilityGroup {
         try {
             return CURATOR_CACHE.get(jdbcUrl, () -> {
                 CuratorFramework curator = createCurator(jdbcUrl, properties);
-                if (!curator.blockUntilConnected(PHOENIX_HA_ZK_CONNECTION_TIMEOUT_MS_DEFAULT,
-                        TimeUnit.MILLISECONDS))
-                    throw new RuntimeException("Failed to connect to the CuratorFramework in "
-                            + "timeout " + PHOENIX_HA_ZK_CONNECTION_TIMEOUT_MS_DEFAULT + " ms");
+                try {
+                    if (!curator.blockUntilConnected(PHOENIX_HA_ZK_CONNECTION_TIMEOUT_MS_DEFAULT,
+                            TimeUnit.MILLISECONDS)) {
+                        throw new RuntimeException("Failed to connect to the CuratorFramework in "
+                                + "timeout " + PHOENIX_HA_ZK_CONNECTION_TIMEOUT_MS_DEFAULT + " ms");
+                    }
+                } catch (Exception e) {
+                    LOG.warn("HA cluster role manager getCurator thread for '{}' is interrupted"
+                        + ", closing CuratorFramework", jdbcUrl, e);
+                    curator.close();
+                    if (e instanceof InterruptedException) {
+                        Thread.currentThread().interrupt();
+                    }
+                    throw e;
+                }
                 return curator;
             });
         } catch (Exception e) {