https://issues.apache.org/bugzilla/show_bug.cgi?id=46384

           Summary: Due to missing synchronization, a member may disappear
                    permanent.
           Product: Tomcat 5
           Version: 5.5.27
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina:Cluster
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: mh...@airplus.com


Below there is a "pseudo-code-extract" of the McastServiceImpl Recieiver- and
Sender-Thread flow.

Now assume the following situation:
- ServerA,ServerB in a cluster; both had added each other to theire
McastMembership 

On ServerA:
t0: The "Sender"-Thread is at position [P0], and found the mm = "ServerB". 
    So in the moment "ServerB" is not in the McastMembership.map!!

t1: The "Receiver"-Thread receives a packet from "ServerB", 
    add this to the McastMembership, 
    calls the SimpleTcpCluster.memberAdded("ServerB") 
    and blocks on [P1]

t2: The "Sender"-Thread continues,
    calls SimpleTcpCluster.memberDisappeared("ServerB").


This leads to the following situation:
- the "ServerB" is in the McastMembership.map (and without timeouts, it wont
disappear)
- there is no Sessionreplication to "ServerB" 


That's it



Thread: Cluster-MembershipReceiver

McastServiceImpl.receive
   added= sync McastMembership.memberAlive(mm) { 
     if (mm not in map) then map+=mm;return true;
     else (mark mm as new); return false;
   }
   if (added) {
      SimpleTcpCluster.memberAdded(mm)
        log.info("Replication member added:" + member);
        sync ReplicationTransmitter.add(mm);
   }

  checkExpire
   ---[P1]---
   sync on McastServiceImpl(expiredMutex) {
      mm = sync McastMembership.expire() {
         if (mm in map to old) then map-=mm;
         return mm;
      }
      SimpleTcpCluster.memberDisappeared(mm);
        log.info("Received member disappeared:" + member);
        sync ReplicationTransmitter.remove(mm);
   }                      



Thread: Cluster-MembershipSender

  McastServiceImpl.send()

  checkExpire
   sync on McastServiceImpl(expiredMutex) {
      mm = sync McastMembership.expire() {
         if (mm in map to old) then map-=mm;
         return mm;
      }
      ---[P0]---
      SimpleTcpCluster.memberDisappeared(mm);
        log.info("Received member disappeared:" + member);
        sync ReplicationTransmitter.remove(mm);
   }


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to