Program: 47832
Project: 47832
Buggy source:
@Test public void testOutOfSyncMemberList() throws Exception {
  Config c1=buildConfig(false);
  Config c2=buildConfig(false);
  Config c3=buildConfig(false);
  c1.getNetworkConfig().setPort(25701);
  c2.getNetworkConfig().setPort(25702);
  c3.getNetworkConfig().setPort(25703);
  List<String> allMembers=Arrays.asList("String_Node_Str");
  c1.getNetworkConfig().getJoin().getTcpIpConfig().setMembers(allMembers);
  c2.getNetworkConfig().getJoin().getTcpIpConfig().setMembers(allMembers);
  c3.getNetworkConfig().getJoin().getTcpIpConfig().setMembers(allMembers);
  final HazelcastInstance h1=Hazelcast.newHazelcastInstance(c1);
  final HazelcastInstance h2=Hazelcast.newHazelcastInstance(c2);
  final HazelcastInstance h3=Hazelcast.newHazelcastInstance(c3);
  assertEquals(3,h1.getCluster().getMembers().size());
  assertEquals(3,h2.getCluster().getMembers().size());
  assertEquals(3,h3.getCluster().getMembers().size());
  final HazelcastInstance[] instances=new HazelcastInstance[]{h1,h2,h3};
  final AtomicBoolean doingWork=new AtomicBoolean(true);
  Thread[] workThreads=new Thread[instances.length];
  for (int i=0; i < instances.length; i++) {
    final int threadNum=i;
    workThreads[threadNum]=new Thread(new Runnable(){
      public void run(){
        while (doingWork.get()) {
          final HazelcastInstance hz=instances[threadNum];
          Set<Member> members=new HashSet<Member>(hz.getCluster().getMembers());
          members.remove(hz.getCluster().getLocalMember());
          final Map<Member,Future<String>> futures=hz.getExecutorService("String_Node_Str").submitToMembers(new PingCallable(),members);
          for (          Future<String> f : futures.values()) {
            try {
              f.get();
            }
 catch (            MemberLeftException ignored) {
            }
catch (            Exception e) {
              e.printStackTrace();
            }
          }
          try {
            Thread.sleep(2000);
          }
 catch (          InterruptedException e) {
            e.printStackTrace();
          }
        }
      }
    }
);
    workThreads[threadNum].start();
  }
  final Node n3=TestUtil.getNode(h3);
  n3.clusterService.removeAddress(((MemberImpl)h1.getCluster().getLocalMember()).getAddress());
  Thread.sleep(30 * 1000);
  doingWork.set(false);
  for (  Thread t : workThreads) {
    t.join();
  }
  assertEquals(3,h1.getCluster().getMembers().size());
  assertEquals(3,h2.getCluster().getMembers().size());
  assertEquals(3,h3.getCluster().getMembers().size());
}

Fixed version (ground truth):
@Test public void testOutOfSyncMemberList() throws Exception {
  List<HazelcastInstance> instanceList=buildInstances(3,25701);
  final HazelcastInstance h1=instanceList.get(0);
  final HazelcastInstance h2=instanceList.get(1);
  final HazelcastInstance h3=instanceList.get(2);
  assertEquals(3,h1.getCluster().getMembers().size());
  assertEquals(3,h2.getCluster().getMembers().size());
  assertEquals(3,h3.getCluster().getMembers().size());
  final HazelcastInstance[] instances=new HazelcastInstance[]{h1,h2,h3};
  final AtomicBoolean doingWork=new AtomicBoolean(true);
  Thread[] workThreads=new Thread[instances.length];
  for (int i=0; i < instances.length; i++) {
    final int threadNum=i;
    workThreads[threadNum]=new Thread(new Runnable(){
      public void run(){
        while (doingWork.get()) {
          final HazelcastInstance hz=instances[threadNum];
          Set<Member> members=new HashSet<Member>(hz.getCluster().getMembers());
          members.remove(hz.getCluster().getLocalMember());
          final Map<Member,Future<String>> futures=hz.getExecutorService("String_Node_Str").submitToMembers(new PingCallable(),members);
          for (          Future<String> f : futures.values()) {
            try {
              f.get();
            }
 catch (            MemberLeftException ignored) {
            }
catch (            Exception e) {
              e.printStackTrace();
            }
          }
          try {
            Thread.sleep(2000);
          }
 catch (          InterruptedException e) {
            e.printStackTrace();
          }
        }
      }
    }
);
    workThreads[threadNum].start();
  }
  final Node n3=TestUtil.getNode(h3);
  n3.clusterService.removeAddress(((MemberImpl)h1.getCluster().getLocalMember()).getAddress());
  Thread.sleep(30 * 1000);
  doingWork.set(false);
  for (  Thread t : workThreads) {
    t.join();
  }
  assertEquals(3,h1.getCluster().getMembers().size());
  assertEquals(3,h2.getCluster().getMembers().size());
  assertEquals(3,h3.getCluster().getMembers().size());
}