Program: 80320
Project: 80320
Buggy source:
/** 
 * Send worker results to master; wait for current master stop; get current master result.
 */
@Override public void postIteration(final WorkerContext<MASTER_RESULT,WORKER_RESULT> context){
  final long timeOutThreshold=NumberFormatUtils.getLong(context.getProps().getProperty(GUAGUA_WORKER_GETRESULT_TIMEOUT),GUAGUA_DEFAULT_WORKER_GETRESULT_TIMEOUT);
  while (true) {
    this.isTimeoutToGetCurrentMasterResult=false;
    int latestIteraton=getLatestMasterIteration(context);
    if (context.getCurrentIteration() == latestIteraton + 1 && context.getCurrentIteration() <= context.getTotalIteration()) {
      new BasicCoordinatorCommand(){
        @Override public void doExecute() throws KeeperException, InterruptedException {
          String appId=context.getAppId();
          int currentIteration=context.getCurrentIteration();
          final String appMasterNode=getCurrentMasterNode(appId,currentIteration).toString();
          BytableWrapper workerMessage=new BytableWrapper();
          workerMessage.setBytes(NettyWorkerCoordinator.this.getWorkerSerializer().objectToBytes(context.getWorkerResult()));
          workerMessage.setCurrentIteration(context.getCurrentIteration());
          workerMessage.setContainerId(context.getContainerId());
          workerMessage.setStopMessage(false);
          LOG.debug("String_Node_Str",workerMessage);
          NettyWorkerCoordinator.this.clientChannel.write(workerMessage);
          final long start=System.nanoTime();
          new RetryCoordinatorCommand(isFixedTime(),getSleepTime()){
            @Override public boolean retryExecution() throws KeeperException, InterruptedException {
              try {
                if (TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start) >= timeOutThreshold) {
                  NettyWorkerCoordinator.this.isTimeoutToGetCurrentMasterResult=true;
                  return true;
                }
                return getZooKeeper().exists(appMasterNode,false) != null || NettyWorkerCoordinator.this.isServerShutdownOrClientDisconnect.get();
              }
 catch (              KeeperException.NoNodeException e) {
                if (System.nanoTime() % 10 == 0) {
                  LOG.warn("String_Node_Str",appMasterNode);
                }
                return false;
              }
            }
          }
.execute();
          if (!NettyWorkerCoordinator.this.isTimeoutToGetCurrentMasterResult) {
            LOG.info("String_Node_Str",context.getAppId(),context.getContainerId(),context.getCurrentIteration(),TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start));
            if (!NettyWorkerCoordinator.this.isServerShutdownOrClientDisconnect.get()) {
              String appMasterSplitNode=getCurrentMasterSplitNode(appId,currentIteration).toString();
              setMasterResult(context,appMasterNode,appMasterSplitNode);
              LOG.info("String_Node_Str");
            }
          }
        }
      }
.execute();
      if (NettyWorkerCoordinator.this.isTimeoutToGetCurrentMasterResult) {
        continue;
      }
 else {
        break;
      }
    }
 else {
      LOG.info("String_Node_Str",context.getAppId(),context.getContainerId(),latestIteraton);
      context.setCurrentIteration(latestIteraton);
      if (!context.isInitIteration()) {
        new BasicCoordinatorCommand(){
          @Override public void doExecute() throws KeeperException, InterruptedException {
            String appId=context.getAppId();
            int lastIteration=context.getCurrentIteration();
            final String appMasterNode=getCurrentMasterNode(appId,lastIteration).toString();
            final String appMasterSplitNode=getCurrentMasterSplitNode(appId,lastIteration).toString();
            setMasterResult(context,appMasterNode,appMasterSplitNode);
          }
        }
.execute();
      }
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * Send worker results to master; wait for current master stop; get current master result.
 */
@Override public void postIteration(final WorkerContext<MASTER_RESULT,WORKER_RESULT> context){
  final long timeOutThreshold=NumberFormatUtils.getLong(context.getProps().getProperty(GUAGUA_WORKER_GETRESULT_TIMEOUT),GUAGUA_DEFAULT_WORKER_GETRESULT_TIMEOUT);
  while (true) {
    this.isTimeoutToGetCurrentMasterResult=false;
    this.isMasterZnodeCleaned=false;
    int latestIteraton=getLatestMasterIteration(context);
    if (context.getCurrentIteration() == latestIteraton + 1 && context.getCurrentIteration() <= context.getTotalIteration()) {
      new BasicCoordinatorCommand(){
        @Override public void doExecute() throws KeeperException, InterruptedException {
          String appId=context.getAppId();
          int currentIteration=context.getCurrentIteration();
          final String appMasterNode=getCurrentMasterNode(appId,currentIteration).toString();
          BytableWrapper workerMessage=new BytableWrapper();
          workerMessage.setBytes(NettyWorkerCoordinator.this.getWorkerSerializer().objectToBytes(context.getWorkerResult()));
          workerMessage.setCurrentIteration(context.getCurrentIteration());
          workerMessage.setContainerId(context.getContainerId());
          workerMessage.setStopMessage(false);
          LOG.debug("String_Node_Str",workerMessage);
          NettyWorkerCoordinator.this.clientChannel.write(workerMessage);
          final long start=System.nanoTime();
          new RetryCoordinatorCommand(isFixedTime(),getSleepTime()){
            @Override public boolean retryExecution() throws KeeperException, InterruptedException {
              try {
                if (TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start) >= timeOutThreshold) {
                  NettyWorkerCoordinator.this.isTimeoutToGetCurrentMasterResult=true;
                  return true;
                }
                return getZooKeeper().exists(appMasterNode,false) != null || NettyWorkerCoordinator.this.isServerShutdownOrClientDisconnect.get();
              }
 catch (              KeeperException.NoNodeException e) {
                if (System.nanoTime() % 10 == 0) {
                  LOG.warn("String_Node_Str",appMasterNode);
                }
                return false;
              }
            }
          }
.execute();
          if (!NettyWorkerCoordinator.this.isTimeoutToGetCurrentMasterResult) {
            LOG.info("String_Node_Str",context.getAppId(),context.getContainerId(),context.getCurrentIteration(),TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start));
            if (!NettyWorkerCoordinator.this.isServerShutdownOrClientDisconnect.get()) {
              String appMasterSplitNode=getCurrentMasterSplitNode(appId,currentIteration).toString();
              try {
                setMasterResult(context,appMasterNode,appMasterSplitNode);
              }
 catch (              KeeperException.NoNodeException e) {
                NettyWorkerCoordinator.this.isMasterZnodeCleaned=true;
                LOG.warn("String_Node_Str",appMasterNode);
              }
              LOG.info("String_Node_Str");
            }
          }
        }
      }
.execute();
      if (NettyWorkerCoordinator.this.isTimeoutToGetCurrentMasterResult || NettyWorkerCoordinator.this.isMasterZnodeCleaned) {
        continue;
      }
 else {
        break;
      }
    }
 else {
      LOG.info("String_Node_Str",context.getAppId(),context.getContainerId(),latestIteraton);
      context.setCurrentIteration(latestIteraton);
      if (!context.isInitIteration()) {
        new BasicCoordinatorCommand(){
          @Override public void doExecute() throws KeeperException, InterruptedException {
            String appId=context.getAppId();
            int lastIteration=context.getCurrentIteration();
            final String appMasterNode=getCurrentMasterNode(appId,lastIteration).toString();
            final String appMasterSplitNode=getCurrentMasterSplitNode(appId,lastIteration).toString();
            try {
              setMasterResult(context,appMasterNode,appMasterSplitNode);
            }
 catch (            KeeperException.NoNodeException e) {
              NettyWorkerCoordinator.this.isMasterZnodeCleaned=true;
              LOG.warn("String_Node_Str",appMasterNode);
            }
          }
        }
.execute();
      }
      if (NettyWorkerCoordinator.this.isMasterZnodeCleaned) {
        continue;
      }
 else {
        break;
      }
    }
  }
}