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

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

commit 847ae81d9f2dcf7ce39ea4d2c37ff68004bb63b5
Author: HTHou <[email protected]>
AuthorDate: Fri Nov 7 15:45:39 2025 +0800

    Avoid unnecessary ssl error log caused by jdk bug
---
 .../apache/iotdb/rpc/NettyTNonblockingTransport.java |  9 +++++----
 .../apache/iotdb/rpc/TElasticFramedTransport.java    | 20 ++++++++++++++------
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git 
a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/NettyTNonblockingTransport.java
 
b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/NettyTNonblockingTransport.java
index b42b901cc18..549e1bb2e0b 100644
--- 
a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/NettyTNonblockingTransport.java
+++ 
b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/NettyTNonblockingTransport.java
@@ -168,10 +168,11 @@ public class NettyTNonblockingTransport extends 
TNonblockingTransport {
                                   "SSL handshake completed successfully for 
{}:{}", host, port);
                             }
                           } else {
-                            if (!future
-                                .cause()
-                                .getMessage()
-                                .contains("SslHandler removed before handshake 
completed")) {
+                            if (future.cause().getMessage() != null
+                                && !future
+                                    .cause()
+                                    .getMessage()
+                                    .contains("SslHandler removed before 
handshake completed")) {
                               logger.warn(
                                   "SSL handshake failed for {}:{}", host, 
port, future.cause());
                             } else if (logger.isDebugEnabled()) {
diff --git 
a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java
 
b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java
index c366d8a9333..6008988a809 100644
--- 
a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java
+++ 
b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java
@@ -132,13 +132,21 @@ public class TElasticFramedTransport extends TTransport {
       if (e.getCause() instanceof SocketTimeoutException) {
         throw new TTransportException(TTransportException.TIMED_OUT, 
e.getCause());
       }
-      // When client with SSL shut down due to time out. Some unnecessary 
error logs may be printed.
-      // Adding this workaround to avoid the problem.
-      if (e.getCause() instanceof SSLHandshakeException
-          && e.getCause().getCause() != null
-          && e.getCause().getCause() instanceof EOFException) {
-        throw new TTransportException(TTransportException.END_OF_FILE, 
e.getCause());
+      if (e.getCause() instanceof SSLHandshakeException) {
+        // There is an unsolved JDK bug 
https://bugs.openjdk.org/browse/JDK-8221218.
+        // Adding this workaround to avoid the error log printed.
+        if (e.getMessage()
+            .contains("Insufficient buffer remaining for AEAD cipher fragment 
(2).")) {
+          throw new TTransportException(TTransportException.END_OF_FILE, 
e.getCause());
+        }
+        // When client with SSL shutdown due to time out. Some unnecessary 
error logs may be
+        // printed.
+        // Adding this workaround to avoid the problem.
+        if (e.getCause().getCause() != null && e.getCause().getCause() 
instanceof EOFException) {
+          throw new TTransportException(TTransportException.END_OF_FILE, 
e.getCause());
+        }
       }
+
       if (e.getCause() instanceof SSLException
           && e.getMessage().contains("Unsupported or unrecognized SSL 
message")) {
         SocketAddress remoteAddress = null;

Reply via email to