Program: 48045
Project: 48045
Buggy source:
@Test public void testGracefulShutdown3() throws Exception {
  Config config=new Config();
  config.getMapConfig(MAP_NAME).setBackupCount(1);
  TestHazelcastInstanceFactory f=createHazelcastInstanceFactory(6);
  final HazelcastInstance hz=f.newHazelcastInstance(config);
  final IMap<Object,Object> map=hz.getMap(MAP_NAME);
  final int size=50000;
  for (int i=0; i < size; i++) {
    map.put(i,i);
  }
  final HazelcastInstance hz2=f.newHazelcastInstance(config);
  final IMap<Object,Object> map2=hz2.getMap(MAP_NAME);
  final HazelcastInstance hz3=f.newHazelcastInstance(config);
  final IMap<Object,Object> map3=hz3.getMap(MAP_NAME);
  final HazelcastInstance hz4=f.newHazelcastInstance(config);
  final IMap<Object,Object> map4=hz4.getMap(MAP_NAME);
  final HazelcastInstance hz5=f.newHazelcastInstance(config);
  final IMap<Object,Object> map5=hz5.getMap(MAP_NAME);
  final HazelcastInstance hz6=f.newHazelcastInstance(config);
  final IMap<Object,Object> map6=hz6.getMap(MAP_NAME);
  assertEquals(size,map2.size());
  assertEquals(size,map3.size());
  assertEquals(size,map4.size());
  assertEquals(size,map5.size());
  assertEquals(size,map6.size());
  hz6.shutdown();
  assertEquals(size,map.size());
  assertEquals(size,map2.size());
  assertEquals(size,map3.size());
  assertEquals(size,map4.size());
  assertEquals(size,map5.size());
  hz2.shutdown();
  assertEquals(size,map.size());
  assertEquals(size,map3.size());
  assertEquals(size,map4.size());
  assertEquals(size,map5.size());
  hz5.shutdown();
  assertEquals(size,map.size());
  assertEquals(size,map3.size());
  assertEquals(size,map4.size());
  hz3.shutdown();
  assertEquals(size,map.size());
  assertEquals(size,map4.size());
  hz4.shutdown();
  assertEquals(size,map.size());
}

Fixed version (ground truth):
@Test public void testGracefulShutdown3() throws Exception {
  Config config=new Config();
  config.getMapConfig(MAP_NAME).setBackupCount(1);
  TestHazelcastInstanceFactory f=createHazelcastInstanceFactory(6);
  final HazelcastInstance hz=f.newHazelcastInstance(config);
  final IMap<Integer,Integer> map=hz.getMap(MAP_NAME);
  final int size=50000;
  for (int i=0; i < size; i++) {
    map.put(i,i);
  }
  final HazelcastInstance hz2=f.newHazelcastInstance(config);
  final IMap<Integer,Integer> map2=hz2.getMap(MAP_NAME);
  final HazelcastInstance hz3=f.newHazelcastInstance(config);
  final IMap<Integer,Integer> map3=hz3.getMap(MAP_NAME);
  final HazelcastInstance hz4=f.newHazelcastInstance(config);
  final IMap<Integer,Integer> map4=hz4.getMap(MAP_NAME);
  final HazelcastInstance hz5=f.newHazelcastInstance(config);
  final IMap<Integer,Integer> map5=hz5.getMap(MAP_NAME);
  final HazelcastInstance hz6=f.newHazelcastInstance(config);
  final IMap<Integer,Integer> map6=hz6.getMap(MAP_NAME);
  waitForSafeStateAndCheckSize(size,hz2,map2);
  waitForSafeStateAndCheckSize(size,hz3,map3);
  waitForSafeStateAndCheckSize(size,hz4,map4);
  waitForSafeStateAndCheckSize(size,hz5,map5);
  waitForSafeStateAndCheckSize(size,hz6,map6);
  shutdownAndWait(hz6);
  waitForSafeStateAndCheckSize(size,hz,map);
  waitForSafeStateAndCheckSize(size,hz2,map2);
  waitForSafeStateAndCheckSize(size,hz3,map3);
  waitForSafeStateAndCheckSize(size,hz4,map4);
  waitForSafeStateAndCheckSize(size,hz5,map5);
  shutdownAndWait(hz2);
  waitForSafeStateAndCheckSize(size,hz,map);
  waitForSafeStateAndCheckSize(size,hz3,map3);
  waitForSafeStateAndCheckSize(size,hz4,map4);
  waitForSafeStateAndCheckSize(size,hz5,map5);
  shutdownAndWait(hz5);
  waitForSafeStateAndCheckSize(size,hz,map);
  waitForSafeStateAndCheckSize(size,hz3,map3);
  waitForSafeStateAndCheckSize(size,hz4,map4);
  shutdownAndWait(hz3);
  waitForSafeStateAndCheckSize(size,hz,map);
  waitForSafeStateAndCheckSize(size,hz4,map4);
  shutdownAndWait(hz4);
  waitForSafeStateAndCheckSize(size,hz,map);
}