Program: 48053
Project: 48053
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<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);
  waitForMigrationAndCheckSize(size,hz2,map2);
  waitForMigrationAndCheckSize(size,hz3,map3);
  waitForMigrationAndCheckSize(size,hz4,map4);
  waitForMigrationAndCheckSize(size,hz5,map5);
  waitForMigrationAndCheckSize(size,hz6,map6);
  shutdownAndWait(hz6);
  waitForMigrationAndCheckSize(size,hz,map);
  waitForMigrationAndCheckSize(size,hz2,map2);
  waitForMigrationAndCheckSize(size,hz3,map3);
  waitForMigrationAndCheckSize(size,hz4,map4);
  waitForMigrationAndCheckSize(size,hz5,map5);
  shutdownAndWait(hz2);
  waitForMigrationAndCheckSize(size,hz,map);
  waitForMigrationAndCheckSize(size,hz3,map3);
  waitForMigrationAndCheckSize(size,hz4,map4);
  waitForMigrationAndCheckSize(size,hz5,map5);
  shutdownAndWait(hz5);
  waitForMigrationAndCheckSize(size,hz,map);
  waitForMigrationAndCheckSize(size,hz3,map3);
  waitForMigrationAndCheckSize(size,hz4,map4);
  shutdownAndWait(hz3);
  waitForMigrationAndCheckSize(size,hz,map);
  waitForMigrationAndCheckSize(size,hz4,map4);
  shutdownAndWait(hz4);
  waitForMigrationAndCheckSize(size,hz,map);
}

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);
}