Program: 79468
Project: 79468
Buggy source:
protected void doTestConcurrentStartup(int size,final Duration staggerStart) throws Exception {
  useSharedTime();
  List<Thread> spawned=MutableList.of();
  for (int i=0; i < size; i++) {
    final HaMgmtNode n=newNode();
    Thread t=new Thread(){
      public void run(){
        if (staggerStart != null)         Time.sleep(staggerStart.multiply(Math.random()));
        n.ha.start(HighAvailabilityMode.AUTO);
      }
    }
;
    spawned.add(t);
    t.start();
  }
  Assert.assertTrue(Repeater.create().every(Duration.millis(1)).limitTimeTo(Duration.THIRTY_SECONDS).until(new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      ManagementPlaneSyncRecord memento=nodes.get(0).ha.getManagementPlaneSyncState();
      int masters=0, standbys=0, savedMasters=0, savedStandbys=0;
      for (      HaMgmtNode n : nodes) {
        if (n.ha.getNodeState() == ManagementNodeState.MASTER)         masters++;
        if (n.ha.getNodeState() == ManagementNodeState.STANDBY)         standbys++;
        ManagementNodeSyncRecord m=memento.getManagementNodes().get(n.ownNodeId);
        if (m != null) {
          if (m.getStatus() == ManagementNodeState.MASTER)           savedMasters++;
          if (m.getStatus() == ManagementNodeState.STANDBY)           savedStandbys++;
        }
      }
      log.info("String_Node_Str" + nodes.size() + "String_Node_Str"+ masters+ "String_Node_Str"+ standbys+ "String_Node_Str"+ memento.getManagementNodes().size()+ "String_Node_Str"+ memento.getMasterNodeId()+ "String_Node_Str"+ savedMasters+ "String_Node_Str"+ savedStandbys+ "String_Node_Str");
      return masters == 1 && standbys == nodes.size() - 1 && savedMasters == 1 && savedStandbys == nodes.size() - 1;
    }
  }
).run());
  for (  Thread t : spawned)   t.join(Duration.THIRTY_SECONDS.toMilliseconds());
}

Fixed version (ground truth):
protected void doTestConcurrentStartup(int size,final Duration staggerStart) throws Exception {
  useSharedTime();
  List<Thread> spawned=MutableList.of();
  for (int i=0; i < size; i++) {
    final HaMgmtNode n=newNode();
    Thread t=new Thread(){
      public void run(){
        if (staggerStart != null)         Time.sleep(staggerStart.multiply(Math.random()));
        n.ha.start(HighAvailabilityMode.AUTO);
        n.ha.setPollPeriod(Duration.millis(20));
      }
    }
;
    spawned.add(t);
    t.start();
  }
  try {
    final Stopwatch timer=Stopwatch.createStarted();
    Assert.assertTrue(Repeater.create().backoff(Duration.millis(1),1.2,Duration.millis(50)).limitTimeTo(Duration.THIRTY_SECONDS).until(new Callable<Boolean>(){
      @Override public Boolean call() throws Exception {
        ManagementPlaneSyncRecord memento=nodes.get(0).ha.getManagementPlaneSyncState();
        int masters=0, standbys=0, savedMasters=0, savedStandbys=0;
        for (        HaMgmtNode n : nodes) {
          if (n.ha.getNodeState() == ManagementNodeState.MASTER)           masters++;
          if (n.ha.getNodeState() == ManagementNodeState.STANDBY)           standbys++;
          ManagementNodeSyncRecord m=memento.getManagementNodes().get(n.ownNodeId);
          if (m != null) {
            if (m.getStatus() == ManagementNodeState.MASTER)             savedMasters++;
            if (m.getStatus() == ManagementNodeState.STANDBY)             savedStandbys++;
          }
        }
        log.info("String_Node_Str" + nodes.size() + "String_Node_Str"+ masters+ "String_Node_Str"+ standbys+ "String_Node_Str"+ memento.getManagementNodes().size()+ "String_Node_Str"+ memento.getMasterNodeId()+ "String_Node_Str"+ savedMasters+ "String_Node_Str"+ savedStandbys+ "String_Node_Str");
        if (timer.isRunning() && Duration.of(timer).compareTo(Duration.TEN_SECONDS) > 0) {
          log.warn("String_Node_Str");
          timer.stop();
        }
        return masters == 1 && standbys == nodes.size() - 1 && savedMasters == 1 && savedStandbys == nodes.size() - 1;
      }
    }
).run());
  }
 catch (  Throwable t) {
    log.warn("String_Node_Str" + t,t);
    throw Exceptions.propagate(t);
  }
  for (  Thread t : spawned)   t.join(Duration.THIRTY_SECONDS.toMilliseconds());
}