geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject [geode] branch feature/GEODE-6369 updated: moved test changes to another branch & added debug logging for Connection.java
Date Thu, 07 Feb 2019 23:43:19 GMT
This is an automated email from the ASF dual-hosted git repository.

bschuchardt pushed a commit to branch feature/GEODE-6369
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/feature/GEODE-6369 by this push:
     new 8906271  moved test changes to another branch & added debug logging for Connection.java
8906271 is described below

commit 8906271ce9f12a23b4eedb8350c752a24f6c17d9
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
AuthorDate: Thu Feb 7 15:40:17 2019 -0800

    moved test changes to another branch & added debug logging for Connection.java
---
 .../apache/geode/distributed/LocatorDUnitTest.java | 54 +++++++++-------------
 .../org/apache/geode/internal/tcp/Connection.java  | 22 +++++++--
 2 files changed, 41 insertions(+), 35 deletions(-)

diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/LocatorDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/distributed/LocatorDUnitTest.java
index 3e2d3a5..e5aaaa0 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/distributed/LocatorDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/LocatorDUnitTest.java
@@ -38,7 +38,6 @@ import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTOR
 import static org.apache.geode.distributed.ConfigurationProperties.START_LOCATOR;
 import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION;
 import static org.apache.geode.internal.logging.LogWriterLevel.ALL;
-import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
@@ -91,6 +90,7 @@ import org.apache.geode.internal.logging.LocalLogWriter;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.security.SecurableCommunicationChannel;
 import org.apache.geode.internal.tcp.Connection;
+import org.apache.geode.test.awaitility.GeodeAwaitility;
 import org.apache.geode.test.dunit.AsyncInvocation;
 import org.apache.geode.test.dunit.DUnitBlackboard;
 import org.apache.geode.test.dunit.DistributedTestUtils;
@@ -253,7 +253,7 @@ public class LocatorDUnitTest implements java.io.Serializable {
       DistributedLockService serviceNamed =
           DistributedLockService.getServiceNamed("test service");
       serviceNamed.lock("foo3", 0, 0);
-      await()
+      GeodeAwaitility.await()
           .until(serviceNamed::isLockGrantor);
       assertThat(serviceNamed.isLockGrantor()).isTrue();
     });
@@ -682,7 +682,7 @@ public class LocatorDUnitTest implements java.io.Serializable {
 
       logger.info("waiting for my distributed system to disconnect due to partition detection");
 
-      await().until(() -> !system.isConnected());
+      GeodeAwaitility.await().until(() -> !system.isConnected());
 
       if (system.isConnected()) {
         fail(
@@ -780,7 +780,7 @@ public class LocatorDUnitTest implements java.io.Serializable {
       // stop the locator normally. This should also be okay
       locator.stop();
 
-      await()
+      GeodeAwaitility.await()
           .until(() -> {
             assertThat(Locator.getLocator()).describedAs("locator is not stopped").isNull();
             return true;
@@ -1027,37 +1027,37 @@ public class LocatorDUnitTest implements java.io.Serializable {
         loc.stop();
       });
 
-      await().until(testRunnerLocatorDS::isConnected);
+      GeodeAwaitility.await().until(testRunnerLocatorDS::isConnected);
 
       waitUntilTheSystemIsConnected(memberThatWillBeShutdownVM, memberVM);
 
       // disconnect the first vm and demonstrate that the non-lead vm and the
       // locator notice the failure and continue to run
       memberThatWillBeShutdownVM.invoke(LocatorDUnitTest::disconnectDistributedSystem);
-      await().until(
+      GeodeAwaitility.await().until(
           () -> memberThatWillBeShutdownVM.invoke(() -> !LocatorDUnitTest.isSystemConnected()));
-      await().until(() -> memberVM.invoke(LocatorDUnitTest::isSystemConnected));
+      GeodeAwaitility.await().until(() -> memberVM.invoke(LocatorDUnitTest::isSystemConnected));
 
       assertThat(memberVM.invoke(LocatorDUnitTest::isSystemConnected))
           .describedAs("Distributed system should not have disconnected").isTrue();
 
-      await("waiting for the old coordinator to drop out").until(
+      GeodeAwaitility.await("waiting for the old coordinator to drop out").until(
           () -> MembershipManagerHelper.getCoordinator(testRunnerLocatorDS) != oldCoordinator);
 
-      await().until(() -> {
+      GeodeAwaitility.await().until(() -> {
         DistributedMember survivingDistributedMember = testRunnerLocatorDS.getDistributedMember();
         DistributedMember coordinator = MembershipManagerHelper.getCoordinator(testRunnerLocatorDS);
         assertThat(survivingDistributedMember).isEqualTo(coordinator);
         return true;
       });
 
-      await("Waiting for the old leader to drop out")
+      GeodeAwaitility.await("Waiting for the old leader to drop out")
           .pollInterval(1, TimeUnit.SECONDS).until(() -> {
             DistributedMember leader = MembershipManagerHelper.getLeadMember(testRunnerLocatorDS);
             return leader != oldLeader;
           });
 
-      await().until(() -> {
+      GeodeAwaitility.await().until(() -> {
         assertThat(distributedMember)
             .isEqualTo(MembershipManagerHelper.getLeadMember(testRunnerLocatorDS));
         return true;
@@ -1164,7 +1164,7 @@ public class LocatorDUnitTest implements java.io.Serializable {
 
       // now ensure that one of the remaining members became the coordinator
 
-      await()
+      GeodeAwaitility.await()
           .until(() -> !coord.equals(MembershipManagerHelper.getCoordinator(system)));
 
       DistributedMember newCoord = MembershipManagerHelper.getCoordinator(system);
@@ -1231,7 +1231,7 @@ public class LocatorDUnitTest implements java.io.Serializable {
       vm0.invoke(LocatorDUnitTest::stopLocator);
 
       // now ensure that one of the remaining members became the coordinator
-      await()
+      GeodeAwaitility.await()
           .until(() -> !coord.equals(MembershipManagerHelper.getCoordinator(system)));
 
       DistributedMember newCoord = MembershipManagerHelper.getCoordinator(system);
@@ -1248,7 +1248,7 @@ public class LocatorDUnitTest implements java.io.Serializable {
 
       final DistributedMember tempCoord = newCoord;
 
-      await()
+      GeodeAwaitility.await()
           .until(() -> !tempCoord.equals(MembershipManagerHelper.getCoordinator(system)));
 
       system.disconnect();
@@ -1306,7 +1306,7 @@ public class LocatorDUnitTest implements java.io.Serializable {
         addDSProps(props);
         system = getConnectedDistributedSystem(props);
 
-        await().until(() -> system.getDM().getViewMembers().size() >= 3);
+        GeodeAwaitility.await().until(() -> system.getDM().getViewMembers().size() >=
3);
 
         // three applications plus
         assertThat(system.getDM().getViewMembers().size()).isEqualTo(5);
@@ -1326,7 +1326,7 @@ public class LocatorDUnitTest implements java.io.Serializable {
 
 
   private void waitUntilLocatorBecomesCoordinator() {
-    await().until(() -> system != null && system.isConnected() &&
+    GeodeAwaitility.await().until(() -> system != null && system.isConnected()
&&
         getCoordinator()
             .getVmKind() == ClusterDistributionManager.LOCATOR_DM_TYPE);
   }
@@ -1385,7 +1385,7 @@ public class LocatorDUnitTest implements java.io.Serializable {
 
       system = getConnectedDistributedSystem(dsProps);
 
-      await().until(() -> system.getDM().getViewMembers().size() == 6);
+      GeodeAwaitility.await().until(() -> system.getDM().getViewMembers().size() == 6);
 
       // three applications plus
       assertThat(system.getDM().getViewMembers().size()).isEqualTo(6);
@@ -1394,7 +1394,7 @@ public class LocatorDUnitTest implements java.io.Serializable {
       vm1.invoke(LocatorDUnitTest::stopLocator);
       vm2.invoke(LocatorDUnitTest::stopLocator);
 
-      await()
+      GeodeAwaitility.await()
           .until(() -> system.getDM().getMembershipManager().getView().size() <= 3);
 
       final String newLocators = host0 + "[" + port2 + "]," + host0 + "[" + port3 + "]";
@@ -1411,7 +1411,7 @@ public class LocatorDUnitTest implements java.io.Serializable {
       startLocator(vm1, dsProps, port2);
       startLocator(vm2, dsProps, port3);
 
-      await()
+      GeodeAwaitility.await()
           .until(() -> !getCoordinator().equals(currentCoordinator)
               && system.getDM().getAllHostedLocators().size() == 2);
 
@@ -1458,7 +1458,6 @@ public class LocatorDUnitTest implements java.io.Serializable {
   public void testMultipleLocatorsRestartingAtSameTimeWithMissingServers() throws Exception
{
     IgnoredException.addIgnoredException("ForcedDisconnectException");
     IgnoredException.addIgnoredException("Possible loss of quorum");
-    IgnoredException.addIgnoredException("java.lang.Exception: Message id is");
 
     VM vm0 = VM.getVM(0);
     VM vm1 = VM.getVM(1);
@@ -1478,7 +1477,6 @@ public class LocatorDUnitTest implements java.io.Serializable {
     final Properties dsProps = getBasicProperties(locators);
     dsProps.setProperty(LOG_LEVEL, logger.getLevel().name());
     dsProps.setProperty(DISABLE_AUTO_RECONNECT, "true");
-    dsProps.setProperty(MEMBER_TIMEOUT, "2000");
 
     addDSProps(dsProps);
     startLocator(vm0, dsProps, port1);
@@ -1493,7 +1491,7 @@ public class LocatorDUnitTest implements java.io.Serializable {
       vm4.invoke(() -> {
         getConnectedDistributedSystem(dsProps);
 
-        await()
+        GeodeAwaitility.await()
             .until(() -> system.getDM().getViewMembers()
                 .size() == 5);
         return true;
@@ -1506,7 +1504,7 @@ public class LocatorDUnitTest implements java.io.Serializable {
       SerializableRunnable waitForDisconnect = new SerializableRunnable("waitForDisconnect")
{
         @Override
         public void run() {
-          await()
+          GeodeAwaitility.await()
               .until(() -> system == null);
         }
       };
@@ -1514,12 +1512,6 @@ public class LocatorDUnitTest implements java.io.Serializable {
       vm1.invoke(() -> waitForDisconnect);
       vm2.invoke(() -> waitForDisconnect);
 
-      // wait for suspect processing to finish
-      vm3.invoke(() -> {
-        await().until(() -> system.getDistributionManager().getAllOtherMembers().size()
== 1);
-      });
-
-
       final String newLocators = host0 + "[" + port2 + "]," + host0 + "[" + port3 + "]";
       dsProps.setProperty(LOCATORS, newLocators);
 
@@ -1813,7 +1805,7 @@ public class LocatorDUnitTest implements java.io.Serializable {
 
   private void waitForMemberToBecomeLeadMemberOfDistributedSystem(final DistributedMember
member,
       final DistributedSystem sys) {
-    await().until(() -> {
+    GeodeAwaitility.await().until(() -> {
       DistributedMember lead = MembershipManagerHelper.getLeadMember(sys);
       if (member != null) {
         return member.equals(lead);
@@ -1912,7 +1904,7 @@ public class LocatorDUnitTest implements java.io.Serializable {
 
   private void waitUntilTheSystemIsConnected(VM vm2, VM locatorVM) {
 
-    await().until(() -> {
+    GeodeAwaitility.await().until(() -> {
       assertThat(isSystemConnected())
           .describedAs("Distributed system should not have disconnected")
           .isTrue();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
index 386a7a5..3c00d27 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
@@ -46,6 +46,7 @@ import javax.net.ssl.SSLException;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.CancelException;
+import org.apache.geode.SerializationException;
 import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.CacheClosedException;
 import org.apache.geode.distributed.DistributedMember;
@@ -2828,7 +2829,7 @@ public class Connection implements Runnable {
 
       Header header = msgReader.readHeader();
 
-      ReplyMessage msg;
+      ReplyMessage msg = null;
       int len;
       if (header.getMessageType() == NORMAL_MSG_TYPE) {
         msg = (ReplyMessage) msgReader.readMessage(header);
@@ -2938,8 +2939,12 @@ public class Connection implements Runnable {
           peerDataBuffer.limit(startPos + messageLength);
 
           if (this.handshakeRead) {
-            readMessage(peerDataBuffer);
-
+            try {
+              readMessage(peerDataBuffer);
+            } catch (SerializationException e) {
+              logger.info("input buffer startPos {} oldLimit {}", startPos, oldLimit);
+              throw e;
+            }
           } else {
             ByteBufferInputStream bbis = new ByteBufferInputStream(peerDataBuffer);
             DataInputStream dis = new DataInputStream(bbis);
@@ -3124,7 +3129,16 @@ public class Connection implements Runnable {
         ReplyProcessor21.initMessageRPId();
         // add serialization stats
         long startSer = this.owner.getConduit().getStats().startMsgDeserialization();
-        msg = (DistributionMessage) InternalDataSerializer.readDSFID(bbis);
+        int startingPosition = peerDataBuffer.position();
+        try {
+          msg = (DistributionMessage) InternalDataSerializer.readDSFID(bbis);
+        } catch (SerializationException e) {
+          logger.info("input buffer starting position {} "
+              + " current position {} limit {} capacity {} message length {}",
+              startingPosition, peerDataBuffer.position(), peerDataBuffer.limit(),
+              peerDataBuffer.capacity(), messageLength);
+          throw e;
+        }
         this.owner.getConduit().getStats().endMsgDeserialization(startSer);
         if (bbis.available() != 0) {
           logger.warn("Message deserialization of {} did not read {} bytes.",


Mime
View raw message