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

justinchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new eed90ce5f19 Pipe: Fixed the issue that frequent logins on the 
receiving end caused indicator leaks (#16076)
eed90ce5f19 is described below

commit eed90ce5f198c3e017aaabce5150908c4d1d8d8a
Author: Zhenyu Luo <[email protected]>
AuthorDate: Mon Aug 4 09:48:16 2025 +0800

    Pipe: Fixed the issue that frequent logins on the receiving end caused 
indicator leaks (#16076)
    
    * Pipe: Fixed the issue that frequent logins on the receiving end caused 
indicator leaks
    
    * fix
    
    * fix
    
    * spotless
---
 .../protocol/thrift/IoTDBDataNodeReceiver.java     | 31 +++++++++++++++-------
 .../iotdb/db/protocol/session/SessionManager.java  |  2 +-
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java
index 9220d236c82..cb2b86efafc 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java
@@ -908,15 +908,28 @@ public class IoTDBDataNodeReceiver extends 
IoTDBFileReceiver {
 
   @Override
   protected TSStatus login() {
-    final BasicOpenSessionResp openSessionResp =
-        SESSION_MANAGER.login(
-            SESSION_MANAGER.getCurrSession(),
-            username,
-            password,
-            ZoneId.systemDefault().toString(),
-            SessionManager.CURRENT_RPC_VERSION,
-            IoTDBConstant.ClientVersion.V_1_0);
-    return RpcUtils.getStatus(openSessionResp.getCode(), 
openSessionResp.getMessage());
+    final IClientSession session = SESSION_MANAGER.getCurrSession();
+
+    if (session != null && !session.isLogin()) {
+      final BasicOpenSessionResp openSessionResp =
+          SESSION_MANAGER.login(
+              session,
+              username,
+              password,
+              ZoneId.systemDefault().toString(),
+              SessionManager.CURRENT_RPC_VERSION,
+              IoTDBConstant.ClientVersion.V_1_0);
+      return RpcUtils.getStatus(openSessionResp.getCode(), 
openSessionResp.getMessage());
+    }
+
+    Long timeToExpire = SESSION_MANAGER.checkPasswordExpiration(username, 
password);
+    if (timeToExpire != null && timeToExpire <= System.currentTimeMillis()) {
+      return RpcUtils.getStatus(
+          TSStatusCode.ILLEGAL_PASSWORD.getStatusCode(),
+          "Password has expired, please use \"ALTER USER\" to change to a new 
one");
+    }
+
+    return AuthorityChecker.checkUser(username, password);
   }
 
   private TSStatus executeStatementForTableModel(
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/SessionManager.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/SessionManager.java
index 05239f348f6..166bfce08e1 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/SessionManager.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/SessionManager.java
@@ -139,7 +139,7 @@ public class SessionManager implements SessionManagerMBean {
    * @return the timestamp when the password will expire. Long.MAX if the 
password never expires.
    *     Null if the password history cannot be found.
    */
-  private Long checkPasswordExpiration(String username, String password) {
+  public Long checkPasswordExpiration(String username, String password) {
     // check password expiration
     long passwordExpirationDays =
         CommonDescriptor.getInstance().getConfig().getPasswordExpirationDays();

Reply via email to