This is an automated email from the ASF dual-hosted git repository. haonan pushed a commit to branch fix_session_pool_oom in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 93a627f25ecb71f591ec190d111a5bda6bfc86ee Author: HTHou <[email protected]> AuthorDate: Tue Feb 7 11:54:36 2023 +0800 fix sessionconnection npe --- session/src/main/java/org/apache/iotdb/session/Session.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/session/src/main/java/org/apache/iotdb/session/Session.java b/session/src/main/java/org/apache/iotdb/session/Session.java index f7b048b30b..19ea1965f0 100644 --- a/session/src/main/java/org/apache/iotdb/session/Session.java +++ b/session/src/main/java/org/apache/iotdb/session/Session.java @@ -1047,7 +1047,8 @@ public class Session implements ISession { TEndPoint endPoint; if (enableRedirection && !deviceIdToEndpoint.isEmpty() - && (endPoint = deviceIdToEndpoint.get(deviceId)) != null) { + && (endPoint = deviceIdToEndpoint.get(deviceId)) != null + && endPointToSessionConnection.containsKey(endPoint)) { return endPointToSessionConnection.get(endPoint); } else { return defaultSessionConnection; @@ -1092,11 +1093,10 @@ public class Session implements ISession { return; } AtomicReference<IoTDBConnectionException> exceptionReference = new AtomicReference<>(); - if (deviceIdToEndpoint.containsKey(deviceId) - && deviceIdToEndpoint.get(deviceId).equals(endpoint)) { - return; + if (!deviceIdToEndpoint.containsKey(deviceId) + || !deviceIdToEndpoint.get(deviceId).equals(endpoint)) { + deviceIdToEndpoint.put(deviceId, endpoint); } - deviceIdToEndpoint.put(deviceId, endpoint); SessionConnection connection = endPointToSessionConnection.computeIfAbsent( endpoint, @@ -3344,7 +3344,8 @@ public class Session implements ISession { * @param insertConsumer insert function * @param <T> * <ul> - B * <li>{@link TSInsertRecordsReq} + * B * + * <li>{@link TSInsertRecordsReq} * <li>{@link TSInsertStringRecordsReq} * <li>{@link TSInsertTabletsReq} * </ul>
