Program: 50227
Project: 50227
Buggy source:
public final void heartBeater(){
  if (!node.joined() || !node.isActive())   return;
  long now=System.currentTimeMillis();
  if (isMaster()) {
    List<Address> lsDeadAddresses=null;
    for (    MemberImpl memberImpl : lsMembers) {
      final Address address=memberImpl.getAddress();
      if (!thisAddress.equals(address)) {
        try {
          Connection conn=node.connectionManager.getConnection(address);
          if (conn != null && conn.live()) {
            if ((now - memberImpl.getLastRead()) >= (MAX_NO_HEARTBEAT_MILLIS)) {
              conn=null;
              if (lsDeadAddresses == null) {
                lsDeadAddresses=new ArrayList<Address>();
              }
              logger.log(Level.WARNING,"String_Node_Str" + address + "String_Node_Str");
              lsDeadAddresses.add(address);
            }
          }
          if (conn != null && conn.live()) {
            if ((now - memberImpl.getLastWrite()) > 500) {
              Packet packet=obtainPacket("String_Node_Str",null,null,ClusterOperation.HEARTBEAT,0);
              sendOrReleasePacket(packet,conn);
            }
          }
        }
 catch (        Exception e) {
          e.printStackTrace();
          logger.log(Level.SEVERE,e.getMessage(),e);
        }
      }
    }
    if (lsDeadAddresses != null) {
      for (      Address address : lsDeadAddresses) {
        logger.log(Level.FINEST,"String_Node_Str" + address);
        doRemoveAddress(address);
        sendRemoveMemberToOthers(address);
      }
    }
  }
 else {
    if (getMasterAddress() != null) {
      MemberImpl masterMember=getMember(getMasterAddress());
      boolean removed=false;
      if (masterMember != null) {
        if ((now - masterMember.getLastRead()) >= (MAX_NO_HEARTBEAT_MILLIS)) {
          logger.log(Level.FINEST,"String_Node_Str");
          doRemoveAddress(getMasterAddress());
          removed=true;
        }
      }
      if (!removed) {
        Packet packet=obtainPacket("String_Node_Str",null,null,ClusterOperation.HEARTBEAT,0);
        Connection connMaster=node.connectionManager.getOrConnect(getMasterAddress());
        sendOrReleasePacket(packet,connMaster);
      }
    }
    for (    MemberImpl member : lsMembers) {
      if (!member.localMember()) {
        Address address=member.getAddress();
        if (shouldConnectTo(address)) {
          Connection conn=node.connectionManager.getOrConnect(address);
          if (conn != null) {
            Packet packet=obtainPacket("String_Node_Str",null,null,ClusterOperation.HEARTBEAT,0);
            sendOrReleasePacket(packet,conn);
          }
 else {
            logger.log(Level.FINEST,"String_Node_Str" + address + "String_Node_Str");
          }
        }
 else {
          Connection conn=node.connectionManager.getConnection(address);
          if (conn != null && conn.live()) {
            if ((now - member.getLastWrite()) > 500) {
              Packet packet=obtainPacket("String_Node_Str",null,null,ClusterOperation.HEARTBEAT,0);
              sendOrReleasePacket(packet,conn);
            }
          }
 else {
            logger.log(Level.FINEST,"String_Node_Str" + address);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public final void heartBeater(){
  if (!node.joined() || !node.isActive())   return;
  long now=System.currentTimeMillis();
  if (isMaster()) {
    List<Address> lsDeadAddresses=null;
    for (    MemberImpl memberImpl : lsMembers) {
      final Address address=memberImpl.getAddress();
      if (!thisAddress.equals(address)) {
        try {
          Connection conn=node.connectionManager.getConnection(address);
          if (conn != null && conn.live()) {
            if ((now - memberImpl.getLastRead()) >= (MAX_NO_HEARTBEAT_MILLIS)) {
              conn=null;
              if (lsDeadAddresses == null) {
                lsDeadAddresses=new ArrayList<Address>();
              }
              logger.log(Level.WARNING,"String_Node_Str" + address + "String_Node_Str");
              lsDeadAddresses.add(address);
            }
            if ((now - memberImpl.getLastWrite()) > 500) {
              Packet packet=obtainPacket("String_Node_Str",null,null,ClusterOperation.HEARTBEAT,0);
              sendOrReleasePacket(packet,conn);
            }
          }
 else           if (conn == null && (now - memberImpl.getLastRead()) > 5000) {
            logMissingConnection(address);
          }
        }
 catch (        Exception e) {
          e.printStackTrace();
          logger.log(Level.SEVERE,e.getMessage(),e);
        }
      }
    }
    if (lsDeadAddresses != null) {
      for (      Address address : lsDeadAddresses) {
        logger.log(Level.FINEST,"String_Node_Str" + address);
        doRemoveAddress(address);
        sendRemoveMemberToOthers(address);
      }
    }
  }
 else {
    if (getMasterAddress() != null) {
      MemberImpl masterMember=getMember(getMasterAddress());
      boolean removed=false;
      if (masterMember != null) {
        if ((now - masterMember.getLastRead()) >= (MAX_NO_HEARTBEAT_MILLIS)) {
          logger.log(Level.FINEST,"String_Node_Str");
          doRemoveAddress(getMasterAddress());
          removed=true;
        }
      }
      if (!removed) {
        Packet packet=obtainPacket("String_Node_Str",null,null,ClusterOperation.HEARTBEAT,0);
        Connection connMaster=node.connectionManager.getOrConnect(getMasterAddress());
        sendOrReleasePacket(packet,connMaster);
      }
    }
    for (    MemberImpl member : lsMembers) {
      if (!member.localMember()) {
        Address address=member.getAddress();
        if (shouldConnectTo(address)) {
          Connection conn=node.connectionManager.getOrConnect(address);
          if (conn != null) {
            Packet packet=obtainPacket("String_Node_Str",null,null,ClusterOperation.HEARTBEAT,0);
            sendOrReleasePacket(packet,conn);
          }
 else {
            logger.log(Level.FINEST,"String_Node_Str" + address + "String_Node_Str");
          }
        }
 else {
          Connection conn=node.connectionManager.getConnection(address);
          if (conn != null && conn.live()) {
            if ((now - member.getLastWrite()) > 500) {
              Packet packet=obtainPacket("String_Node_Str",null,null,ClusterOperation.HEARTBEAT,0);
              sendOrReleasePacket(packet,conn);
            }
          }
 else {
            logger.log(Level.FINEST,"String_Node_Str" + address);
            if (conn == null && (now - member.getLastRead()) > 5000) {
              logMissingConnection(address);
            }
          }
        }
      }
    }
  }
}