You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2023/02/07 03:55:51 UTC

[iotdb] branch fix_client_oom_v1.0.0 updated: fix sessionconnection npe

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

haonan pushed a commit to branch fix_client_oom_v1.0.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/fix_client_oom_v1.0.0 by this push:
     new 5380391cca fix sessionconnection npe
5380391cca is described below

commit 5380391cca14a876c153b662d8261ef5b20be373
Author: HTHou <hh...@outlook.com>
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 fd337d17b0..bad1474733 100644
--- a/session/src/main/java/org/apache/iotdb/session/Session.java
+++ b/session/src/main/java/org/apache/iotdb/session/Session.java
@@ -926,7 +926,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;
@@ -971,11 +972,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,
@@ -3223,7 +3223,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>