GEODE-3041 DistributedMemberDUnitTest.testGroupsInAllVMs fails intermittently
When shutting down the MembershipManager after it has joined we should not use uncleanShutdown because the member will appear to have crashed. Instead we should do a normal shutdown. Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/699577dc Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/699577dc Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/699577dc Branch: refs/heads/feature/GEODE-2558 Commit: 699577dc215a82c451aa4ab9e5812291c6f5aa6e Parents: 0d12756 Author: Bruce Schuchardt <[email protected]> Authored: Thu Jun 8 16:57:20 2017 -0700 Committer: Bruce Schuchardt <[email protected]> Committed: Thu Jun 8 17:02:53 2017 -0700 ---------------------------------------------------------------------- .../geode/distributed/internal/DistributionChannel.java | 8 ++++---- .../geode/distributed/internal/DistributionManager.java | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/geode/blob/699577dc/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionChannel.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionChannel.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionChannel.java index ef4056c..712764d 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionChannel.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionChannel.java @@ -82,20 +82,20 @@ public class DistributionChannel { return membershipManager.send(destinations, content, stats); } - public void disconnect(boolean duringStartup) { + public void disconnect(boolean beforeJoined) { StringBuffer sb = new StringBuffer(); sb.append("Disconnected from distribution channel "); long start = System.currentTimeMillis(); - logger.debug("DistributionChannel disconnecting with " + membershipManager + "; duringStartup=" - + duringStartup); + logger.debug("DistributionChannel disconnecting with " + membershipManager + "; beforeJoined=" + + beforeJoined); if (membershipManager != null) { sb.append(membershipManager.getLocalMember()); sb.append(" (took "); long begin = System.currentTimeMillis(); - if (duringStartup) { + if (beforeJoined) { membershipManager.uncleanShutdown("Failed to start distribution", null); } else { membershipManager.shutdown(); http://git-wip-us.apache.org/repos/asf/geode/blob/699577dc/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java index 029e637..15f45a8 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java @@ -547,6 +547,7 @@ public class DistributionManager implements DM { public static DistributionManager create(InternalDistributedSystem system) { DistributionManager distributionManager = null; + boolean beforeJoined = true; try { @@ -572,6 +573,8 @@ public class DistributionManager implements DM { distributionManager = new DistributionManager(system, transport); distributionManager.assertDistributionManagerType(); + beforeJoined = false; // we have now joined the system + { InternalDistributedMember id = distributionManager.getDistributionManagerId(); if (!"".equals(id.getName())) { @@ -651,7 +654,7 @@ public class DistributionManager implements DM { if (logger.isDebugEnabled()) { logger.debug("cleaning up incompletely started DistributionManager due to exception", r); } - distributionManager.uncleanShutdown(true); + distributionManager.uncleanShutdown(beforeJoined); } throw r; } @@ -2252,7 +2255,7 @@ public class DistributionManager implements DM { * Stops the pusher, puller and processor threads and closes the connection to the transport * layer. This should only be used from shutdown() or from the dm initialization code */ - private void uncleanShutdown(boolean duringStartup) { + private void uncleanShutdown(boolean beforeJoined) { try { this.closeInProgress = true; // set here also to fix bug 36736 removeAllHealthMonitors(); @@ -2294,7 +2297,7 @@ public class DistributionManager implements DM { if (this.channel != null) { logger.info(LocalizedMessage.create( LocalizedStrings.DistributionManager_NOW_CLOSING_DISTRIBUTION_FOR__0, this.myid)); - this.channel.disconnect(duringStartup); + this.channel.disconnect(beforeJoined); // this.channel = null; DO NOT NULL OUT INSTANCE VARIABLES AT SHUTDOWN - bug #42087 } }
