[ 
https://issues.apache.org/jira/browse/GEODE-2497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15876868#comment-15876868
 ] 

ASF GitHub Bot commented on GEODE-2497:
---------------------------------------

Github user kirklund commented on a diff in the pull request:

    https://github.com/apache/geode/pull/402#discussion_r102334223
  
    --- Diff: 
geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionManagerDUnitTest.java
 ---
    @@ -159,77 +159,74 @@ public void testConnectAfterBeingShunned() {
        **/
       @Test
       public void testSurpriseMemberHandling() {
    -    VM vm0 = Host.getHost(0).getVM(0);
    -
    -    InternalDistributedSystem sys = getSystem();
    -    MembershipManager mgr = 
MembershipManagerHelper.getMembershipManager(sys);
     
    +    System.setProperty(DistributionConfig.GEMFIRE_PREFIX + 
"surprise-member-timeout", "3000");
         try {
    -      InternalDistributedMember mbr =
    -          new InternalDistributedMember(NetworkUtils.getIPLiteral(), 
12345);
    +      InternalDistributedSystem sys = getSystem();
    +      MembershipManager mgr = 
MembershipManagerHelper.getMembershipManager(sys);
    +      assertTrue(((GMSMembershipManager) mgr).isCleanupTimerStarted());
     
    -      // first make sure we can't add this as a surprise member (bug 
#44566)
    -
    -      // if the view number isn't being recorded correctly the test will 
pass but the
    -      // functionality is broken
    -      Assert.assertTrue("expected view ID to be greater than zero", 
mgr.getView().getViewId() > 0);
    -
    -      int oldViewId = mbr.getVmViewId();
    -      mbr.setVmViewId((int) mgr.getView().getViewId() - 1);
    -      org.apache.geode.test.dunit.LogWriterUtils.getLogWriter()
    -          .info("current membership view is " + mgr.getView());
    -      org.apache.geode.test.dunit.LogWriterUtils.getLogWriter()
    -          .info("created ID " + mbr + " with view ID " + 
mbr.getVmViewId());
    -      sys.getLogWriter()
    -          .info("<ExpectedException action=add>attempt to add old 
member</ExpectedException>");
    -      sys.getLogWriter()
    -          .info("<ExpectedException action=add>Removing shunned GemFire 
node</ExpectedException>");
           try {
    -        boolean accepted = mgr.addSurpriseMember(mbr);
    -        Assert.assertTrue("member with old ID was not rejected (bug 
#44566)", !accepted);
    -      } finally {
    +        InternalDistributedMember mbr =
    +            new InternalDistributedMember(NetworkUtils.getIPLiteral(), 
12345);
    +
    +        // first make sure we can't add this as a surprise member (bug 
#44566)
    +
    +        // if the view number isn't being recorded correctly the test will 
pass but the
    +        // functionality is broken
    +        Assert.assertTrue("expected view ID to be greater than zero",
    +            mgr.getView().getViewId() > 0);
    +
    +        int oldViewId = mbr.getVmViewId();
    +        mbr.setVmViewId((int) mgr.getView().getViewId() - 1);
    +        org.apache.geode.test.dunit.LogWriterUtils.getLogWriter()
    +            .info("current membership view is " + mgr.getView());
    +        org.apache.geode.test.dunit.LogWriterUtils.getLogWriter()
    +            .info("created ID " + mbr + " with view ID " + 
mbr.getVmViewId());
             sys.getLogWriter()
    -            .info("<ExpectedException action=remove>attempt to add old 
member</ExpectedException>");
    +            .info("<ExpectedException action=add>attempt to add old 
member</ExpectedException>");
    --- End diff --
    
    I forgot we left the xml strings as "ExpectedException" -- you might want 
to chagne this to use the Java API instead of logging a hardcoded string. This 
will help if and when we ever decide to update the xml strings:
    ```java
    IgnoredException.addIgnoredException("attempt to add old member");
    ```
    If you call the static addIgnoredException like this, then it automatically 
gets added to a collection which is part of the dunit tearDown cleanup (ie, it 
will log the removals for you).



> surprise members are never timed out during startup
> ---------------------------------------------------
>
>                 Key: GEODE-2497
>                 URL: https://issues.apache.org/jira/browse/GEODE-2497
>             Project: Geode
>          Issue Type: Bug
>          Components: membership
>            Reporter: Bruce Schuchardt
>            Assignee: Bruce Schuchardt
>
> A system was observed to hang during startup when a "surprise member" was 
> added but then never timed out.  The system hung waiting for a response to a 
> startup message sent to the surprise member.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to