geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject [05/13] geode git commit: GEODE-3409 Client Can't Connect Once Connection Limit Has Been Reached
Date Fri, 25 Aug 2017 17:01:29 GMT
GEODE-3409 Client Can't Connect Once Connection Limit Has Been Reached

ServerConnection cleanup was not decrementing the Acceptor's client
connection count when the protobuf communications mode was in effect.


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

Branch: refs/heads/feature/GEODE-3503
Commit: 20fddb5cc346b604bd611bb857a14b8843a42306
Parents: 92db0a6
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
Authored: Thu Aug 24 15:15:59 2017 -0700
Committer: Bruce Schuchardt <bschuchardt@pivotal.io>
Committed: Thu Aug 24 15:17:18 2017 -0700

----------------------------------------------------------------------
 .../gms/messenger/JGroupsMessenger.java         |  1 +
 .../cache/tier/sockets/ClientHealthMonitor.java |  5 +-
 .../cache/tier/sockets/ServerConnection.java    |  1 +
 .../RoundTripCacheConnectionJUnitTest.java      | 79 ++++++++++++--------
 4 files changed, 53 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/20fddb5c/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
index 122e3ac..b705190 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
@@ -457,6 +457,7 @@ public class JGroupsMessenger implements Messenger {
         }
       }
       if (recipient != null) {
+        logger.warn("Unable to send message to " + recipient, e);
         services.getHealthMonitor().suspect(recipient,
             "Unable to send messages to this member via JGroups");
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/20fddb5c/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientHealthMonitor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientHealthMonitor.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientHealthMonitor.java
index 35cc33f..e877852 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientHealthMonitor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientHealthMonitor.java
@@ -559,11 +559,10 @@ public class ClientHealthMonitor {
     {
       if (serverConnections != null) { // fix for bug 35343
         result = true;
-        // logger.warning("Terminating " + serverConnections.size() + "
-        // connections");
+        // logger.warn("Terminating " + serverConnections.size() + " connections");
         for (Iterator it = serverConnections.iterator(); it.hasNext();) {
           ServerConnection serverConnection = (ServerConnection) it.next();
-          // logger.warning("Terminating " + serverConnection);
+          // logger.warn("Terminating " + serverConnection);
           serverConnection.handleTermination(timedOut);
         }
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/20fddb5c/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnection.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnection.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnection.java
index 394d261..6f56e85 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnection.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnection.java
@@ -1449,6 +1449,7 @@ public abstract class ServerConnection implements Runnable {
     }
     if (this.communicationMode == Acceptor.CLIENT_TO_SERVER || isGatewayConnection()
         || this.communicationMode == Acceptor.MONITOR_TO_SERVER
+        || this.communicationMode == Acceptor.PROTOBUF_CLIENT_SERVER_PROTOCOL
     /* || this.communicationMode == Acceptor.CLIENT_TO_SERVER_FOR_QUEUE */) {
       getAcceptor().decClientServerCnxCount();
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/20fddb5c/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
b/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
index 12cc08b..0fbf9a9 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
@@ -15,6 +15,37 @@
 
 package org.apache.geode.protocol;
 
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_TYPE;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_PASSWORD;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.Socket;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+
+import org.awaitility.Awaitility;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.RestoreSystemProperties;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.DataPolicy;
@@ -24,6 +55,8 @@ import org.apache.geode.cache.server.CacheServer;
 import org.apache.geode.distributed.ConfigurationProperties;
 import org.apache.geode.internal.AvailablePortHelper;
 import org.apache.geode.internal.admin.SSLConfig;
+import org.apache.geode.internal.cache.CacheServerImpl;
+import org.apache.geode.internal.cache.tier.sockets.AcceptorImpl;
 import org.apache.geode.internal.cache.tier.sockets.GenericProtocolServerConnection;
 import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.net.SocketCreatorFactory;
@@ -41,36 +74,6 @@ import org.apache.geode.serialization.registry.exception.CodecAlreadyRegisteredF
 import org.apache.geode.serialization.registry.exception.CodecNotRegisteredForTypeException;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.util.test.TestUtil;
-import org.awaitility.Awaitility;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.contrib.java.lang.system.RestoreSystemProperties;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.Socket;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Stream;
-
-import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS;
-import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE;
-import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD;
-import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_TYPE;
-import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION;
-import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE;
-import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_PASSWORD;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
 
 /**
  * Test that switching on the header byte makes instances of
@@ -269,6 +272,22 @@ public class RoundTripCacheConnectionJUnitTest {
   }
 
   @Test
+  public void testConnectionCountIsProperlyDecremented() throws Exception {
+    CacheServer cacheServer = this.cache.getCacheServers().stream().findFirst().get();
+    AcceptorImpl acceptor = ((CacheServerImpl) cacheServer).getAcceptor();
+    Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -> {
+      return acceptor.getClientServerCnxCount() == 1;
+    });
+    // run another test that creates a connection to the server
+    testNewProtocolGetRegionNamesCallSucceeds();
+    assertFalse(socket.isClosed());
+    socket.close();
+    Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() -> {
+      return acceptor.getClientServerCnxCount() == 0;
+    });
+  }
+
+  @Test
   public void testNewProtocolGetRegionNamesCallSucceeds() throws Exception {
     int correlationId = TEST_GET_CORRELATION_ID; // reuse this value for this test
 


Mime
View raw message