You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/05/22 07:28:07 UTC

[incubator-iotdb] 01/01: fix close twice bug

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

qiaojialin pushed a commit to branch fix_close_session_twice
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit 75a96c8dcca12f059e7b4562415e2124bc3a943e
Author: qiaojialin <64...@qq.com>
AuthorDate: Fri May 22 15:27:57 2020 +0800

    fix close twice bug
---
 server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java  | 4 +++-
 session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
index 372098c..cec6b4e 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
@@ -230,7 +230,9 @@ public class TSServiceImpl implements TSIService.Iface, ServerContext {
   @Override
   public TSStatus closeSession(TSCloseSessionReq req) {
     logger.info("{}: receive close session", IoTDBConstant.GLOBAL_DB_NAME);
-    long sessionId = req.getSessionId();
+    long sessionId = currSessionId.get();
+    currSessionId.remove();
+
     TSStatus tsStatus;
     if (sessionIdUsernameMap.remove(sessionId) == null) {
       tsStatus = RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR);
diff --git a/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java b/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
index 7ad90ce..19c4061 100644
--- a/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
+++ b/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
@@ -696,6 +696,7 @@ public class SessionPool {
         return resp;
       } catch (IoTDBConnectionException e) {
         // TException means the connection is broken, remove it and get a new one.
+        logger.error("Connection error, need to retry: ", e);
         closeSession(session);
         removeSession();
       }