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

CRZbulabula pushed a commit to branch 
upgrade-confignodeclient-rpc-conn-management
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to 
refs/heads/upgrade-confignodeclient-rpc-conn-management by this push:
     new 480bb507ed8 Fix transport leak in ConfigNodeClient during redirect
480bb507ed8 is described below

commit 480bb507ed883f97ffdab8a811a5dcc1ab545314
Author: Yongzao <[email protected]>
AuthorDate: Sun May 10 15:09:12 2026 +0800

    Fix transport leak in ConfigNodeClient during redirect
    
    When a DataNode connects to a Follower ConfigNode and gets redirected
    to the Leader, the connect() method overwrites the transport field
    without closing the old connection. This leaks TCP connections on the
    ConfigNode server side, causing TThreadPoolServer worker threads to
    block indefinitely on abandoned sockets.
---
 .../java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java | 7 +++++++
 1 file changed, 7 insertions(+)

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..d1d9a915f0c 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,13 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
   }
 
   public void connect(TEndPoint endpoint, int timeoutMs) throws TException {
+    // Close old transport to avoid leaking TCP connections on the server side.
+    // Without this, redirect scenarios (Follower -> Leader) overwrite the 
transport
+    // field and leave the old connection open, causing server-side RPC 
threads to
+    // block indefinitely on the abandoned socket.
+    if (transport != null) {
+      transport.close();
+    }
     transport =
         commonConfig.isEnableInternalSSL()
             ? DeepCopyRpcTransportFactory.INSTANCE.getTransport(

Reply via email to