You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by al...@apache.org on 2021/03/22 16:42:56 UTC

[ignite] branch master updated: IGNITE-14160 Issue warning if SSL handshake is too long - Fixes #8792.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new d0ebc48  IGNITE-14160 Issue warning if SSL handshake is too long - Fixes #8792.
d0ebc48 is described below

commit d0ebc489bdfe9cf72b3471f9fa49e10f1e46ef8b
Author: Andrey Kuznetsov <st...@gmail.com>
AuthorDate: Mon Mar 22 19:37:20 2021 +0300

    IGNITE-14160 Issue warning if SSL handshake is too long - Fixes #8792.
    
    Signed-off-by: Aleksey Plekhanov <pl...@gmail.com>
---
 .../ignite/internal/util/nio/ssl/GridNioSslHandler.java      | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslHandler.java
index c6471cb..bde354d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslHandler.java
@@ -54,6 +54,9 @@ class GridNioSslHandler extends ReentrantLock {
     /** */
     private static final long serialVersionUID = 0L;
 
+    /** Handshake duration threshold; warning is logged when exceeded. */
+    private static final long LONG_HANDSHAKE_THRESHOLD_MS = 1000;
+
     /** Grid logger. */
     private IgniteLogger log;
 
@@ -203,6 +206,8 @@ class GridNioSslHandler extends ReentrantLock {
         if (log.isDebugEnabled())
             log.debug("Entered handshake(): [handshakeStatus=" + handshakeStatus + ", ses=" + ses + ']');
 
+        long startTs = U.currentTimeMillis();
+
         lock();
 
         try {
@@ -290,6 +295,13 @@ class GridNioSslHandler extends ReentrantLock {
         }
         finally {
             unlock();
+
+            long elapsed = U.currentTimeMillis() - startTs;
+
+            if (elapsed > LONG_HANDSHAKE_THRESHOLD_MS && log.isInfoEnabled()) {
+                log.info("Handshake took too long: [millis=" + elapsed + ", handshakeStatus=" + handshakeStatus +
+                    ", ses=" + ses + ']');
+            }
         }
 
         if (log.isDebugEnabled())