You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/04/24 15:03:36 UTC

[13/50] [abbrv] ignite git commit: Prove that problem is not in the onFirstMessage hang

Prove that problem is not in the onFirstMessage hang


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c2c18192
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c2c18192
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c2c18192

Branch: refs/heads/ignite-3054
Commit: c2c181922c7c24ea457577e32d2af897c8bec87f
Parents: 4fd3965
Author: Alexandr Kuramshin <ak...@gridgain.com>
Authored: Sat Nov 19 23:11:28 2016 +0300
Committer: Alexandr Kuramshin <ak...@gridgain.com>
Committed: Sat Nov 19 23:11:28 2016 +0300

----------------------------------------------------------------------
 .../spi/communication/tcp/TcpCommunicationSpi.java    | 12 ++++++++++++
 .../tcp/IgniteTcpCommunicationBigClusterTest.java     | 14 ++++++++++++++
 2 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c2c18192/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index afd4db2..ae276dd 100755
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -46,6 +46,7 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
 import javax.net.ssl.SSLEngine;
 import javax.net.ssl.SSLException;
 import org.apache.ignite.Ignite;
@@ -238,6 +239,12 @@ import static org.apache.ignite.internal.util.nio.GridNioSessionMetaKey.SSL_META
 @IgniteSpiConsistencyChecked(optional = false)
 public class TcpCommunicationSpi extends IgniteSpiAdapter
     implements CommunicationSpi<Message>, TcpCommunicationSpiMBean {
+
+    /** */
+    public static final AtomicInteger FIRST_MESSAGE_STARTED_COUNT = new AtomicInteger();
+    /** */
+    public static final AtomicInteger FIRST_MESSAGE_ACTIVE_COUNT = new AtomicInteger();
+
     /** IPC error message. */
     public static final String OUT_OF_RESOURCES_TCP_MSG = "Failed to allocate shared memory segment " +
         "(switching to TCP, may be slower).";
@@ -547,7 +554,12 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                     }
 
                     try {
+                        log.error("onFirstMessage enter, node = " + getLocalNodeId());
+                        FIRST_MESSAGE_STARTED_COUNT.incrementAndGet();
+                        FIRST_MESSAGE_ACTIVE_COUNT.incrementAndGet();
                         onFirstMessage(ses, msg);
+                        FIRST_MESSAGE_ACTIVE_COUNT.decrementAndGet();
+                        log.error("onFirstMessage exit, node = " + getLocalNodeId());
                     }
                     finally {
                         connectGate.leave();

http://git-wip-us.apache.org/repos/asf/ignite/blob/c2c18192/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationBigClusterTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationBigClusterTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationBigClusterTest.java
index a0e545e..a97c858 100755
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationBigClusterTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationBigClusterTest.java
@@ -42,13 +42,16 @@ public class IgniteTcpCommunicationBigClusterTest extends GridCommonAbstractTest
     /** */
     private static final long BROADCAST_PERIOD = 100L;
 
+    /** */
     private static final String CONTROL_ANSWER = "ignite";
 
     /** */
     private static final Logger LOGGER = Logger.getLogger(IgniteTcpCommunicationBigClusterTest.class.getName());
 
+    /** */
     private static final Level LOG_LEVEL = Level.SEVERE;
 
+    /** */
     private CountDownLatch startLatch;
 
     /** */
@@ -75,21 +78,32 @@ public class IgniteTcpCommunicationBigClusterTest extends GridCommonAbstractTest
     /** */
     private static void println(String str) {
         LOGGER.log(LOG_LEVEL, str);
+        logFirstMessageCount();
     }
 
     /** */
     private static void println(String str, Throwable ex) {
         LOGGER.log(LOG_LEVEL, str, ex);
+        logFirstMessageCount();
     }
 
     /** */
     private static void printf(String format, Object... args) {
         LOGGER.log(LOG_LEVEL, MessageFormat.format(format, args));
+        logFirstMessageCount();
     }
 
     /** */
     private static void printf(String format, Throwable ex, Object... args) {
         LOGGER.log(LOG_LEVEL, MessageFormat.format(format, args), ex);
+        logFirstMessageCount();
+    }
+
+    /** */
+    private static void logFirstMessageCount() {
+        LOGGER.log(LOG_LEVEL, MessageFormat.format("onFirstMessage: started = {0}, active = {1}",
+            TcpCommunicationSpi.FIRST_MESSAGE_STARTED_COUNT.get(),
+            TcpCommunicationSpi.FIRST_MESSAGE_ACTIVE_COUNT.get()));
     }
 
     /** */