Program: 31686
Project: 31686
Buggy source:
@Override public void postIteration(final MasterContext<DTMasterParams,DTWorkerParams> context){
  long start=System.currentTimeMillis();
  final int tmpModelFactor=DTrainUtils.tmpModelFactor(context.getTotalIteration());
  if (isRF) {
    if (context.getCurrentIteration() % (tmpModelFactor * 2) == 0) {
      Thread tmpModelPersistThread=new Thread(new Runnable(){
        @Override public void run(){
          Path out=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
          if (!context.getMasterResult().isHalt() && context.getCurrentIteration() != context.getTotalIteration()) {
            writeModelToFileSystem(context.getMasterResult().getTrees(),out);
          }
          saveTmpModelToHDFS(context.getCurrentIteration(),context.getMasterResult().getTrees());
        }
      }
,"String_Node_Str");
      tmpModelPersistThread.setDaemon(true);
      tmpModelPersistThread.start();
    }
  }
 else   if (isGBDT) {
    if (this.treeNum >= 10 && context.getMasterResult().isSwitchToNextTree() && (context.getMasterResult().getTmpTrees().size() - 1) % (this.treeNum / 10) == 0) {
      final List<TreeNode> trees=context.getMasterResult().getTmpTrees();
      if (trees.size() > 1) {
        Thread tmpModelPersistThread=new Thread(new Runnable(){
          @Override public void run(){
            List<TreeNode> subTrees=trees.subList(0,trees.size() - 1);
            Path out=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
            if (!context.getMasterResult().isHalt() && context.getCurrentIteration() != context.getTotalIteration()) {
              writeModelToFileSystem(subTrees,out);
            }
            saveTmpModelToHDFS(subTrees.size(),subTrees);
          }
        }
,"String_Node_Str");
        tmpModelPersistThread.setDaemon(true);
        tmpModelPersistThread.start();
      }
    }
  }
  updateProgressLog(context);
  LOG.debug("String_Node_Str",(System.currentTimeMillis() - start));
}

Fixed version (ground truth):
@Override public void postIteration(final MasterContext<DTMasterParams,DTWorkerParams> context){
  long start=System.currentTimeMillis();
  final int tmpModelFactor=DTrainUtils.tmpModelFactor(context.getTotalIteration());
  final int currentIteration=context.getCurrentIteration();
  final int totalIteration=context.getTotalIteration();
  final boolean isHalt=context.getMasterResult().isHalt();
  if (isRF) {
    if (currentIteration % (tmpModelFactor * 2) == 0) {
      Thread tmpModelPersistThread=new Thread(new Runnable(){
        @Override public void run(){
          Path out=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
          if (!isHalt && currentIteration != totalIteration) {
            writeModelToFileSystem(context.getMasterResult().getTrees(),out);
          }
          saveTmpModelToHDFS(context.getCurrentIteration(),context.getMasterResult().getTrees());
        }
      }
,"String_Node_Str");
      tmpModelPersistThread.setDaemon(true);
      tmpModelPersistThread.start();
    }
  }
 else   if (isGBDT) {
    if (this.treeNum >= 10 && context.getMasterResult().isSwitchToNextTree() && (context.getMasterResult().getTmpTrees().size() - 1) % (this.treeNum / 10) == 0) {
      final List<TreeNode> trees=context.getMasterResult().getTmpTrees();
      if (trees.size() > 1) {
        Thread tmpModelPersistThread=new Thread(new Runnable(){
          @Override public void run(){
            List<TreeNode> subTrees=trees.subList(0,trees.size() - 1);
            Path out=new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
            if (!isHalt && currentIteration != totalIteration) {
              writeModelToFileSystem(subTrees,out);
            }
            saveTmpModelToHDFS(subTrees.size(),subTrees);
          }
        }
,"String_Node_Str");
        tmpModelPersistThread.setDaemon(true);
        tmpModelPersistThread.start();
      }
    }
  }
  updateProgressLog(context);
  LOG.debug("String_Node_Str",(System.currentTimeMillis() - start));
}