You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2026/05/10 07:42:29 UTC

(iotdb) branch master updated: Fix transport leak in ConfigNodeClient during leader redirect (#17631)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new f92e9c0a2c5 Fix transport leak in ConfigNodeClient during leader redirect (#17631)
f92e9c0a2c5 is described below

commit f92e9c0a2c52888fc29ea086f5d715a3b5a4b941
Author: Yongzao <yo...@apache.org>
AuthorDate: Sun May 10 15:42:23 2026 +0800

    Fix transport leak in ConfigNodeClient during leader redirect (#17631)
---
 .../org/apache/iotdb/db/protocol/client/ConfigNodeClient.java     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java
index c552bafc14a..613fbcf5d95 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java
@@ -265,6 +265,10 @@ public class ConfigNodeClient implements IConfigNodeRPCService.Iface, ThriftClie
   }
 
   public void connect(TEndPoint endpoint, int timeoutMs) throws TException {
+    // Close existing transport before reassigning to prevent connection leaks.
+    if (transport != null) {
+      transport.close();
+    }
     transport =
         commonConfig.isEnableInternalSSL()
             ? DeepCopyRpcTransportFactory.INSTANCE.getTransport(
@@ -327,10 +331,6 @@ public class ConfigNodeClient implements IConfigNodeRPCService.Iface, ThriftClie
       }
     }
 
-    if (transport != null) {
-      transport.close();
-    }
-
     for (int tryHostNum = 0; tryHostNum < configNodes.size(); tryHostNum++) {
       cursor = (cursor + 1) % configNodes.size();
       TEndPoint tryEndpoint = configNodes.get(cursor);