Skip to content

Commit f92e9c0

Browse files
authored
Fix transport leak in ConfigNodeClient during leader redirect (#17631)
1 parent eea7e65 commit f92e9c0

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ public ConfigNodeClient(
265265
}
266266

267267
public void connect(TEndPoint endpoint, int timeoutMs) throws TException {
268+
// Close existing transport before reassigning to prevent connection leaks.
269+
if (transport != null) {
270+
transport.close();
271+
}
268272
transport =
269273
commonConfig.isEnableInternalSSL()
270274
? DeepCopyRpcTransportFactory.INSTANCE.getTransport(
@@ -327,10 +331,6 @@ private void tryToConnect(int timeoutMs) throws TException {
327331
}
328332
}
329333

330-
if (transport != null) {
331-
transport.close();
332-
}
333-
334334
for (int tryHostNum = 0; tryHostNum < configNodes.size(); tryHostNum++) {
335335
cursor = (cursor + 1) % configNodes.size();
336336
TEndPoint tryEndpoint = configNodes.get(cursor);

0 commit comments

Comments
 (0)