Program: 31658
Project: 31658
Buggy source:
@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));
}

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) {
            Path tmpModelPath=getTmpModelPath(currentIteration);
            writeModelToFileSystem(context.getMasterResult().getTrees(),out);
            LOG.info("String_Node_Str",tmpModelPath.toString());
            try {
              DataOutputStream outputStream=new DataOutputStream(new GZIPOutputStream(FileSystem.get(DTOutput.this.conf).create(tmpModelPath)));
              FSDataInputStream inputStream=FileSystem.get(DTOutput.this.conf).open(out);
              DataInputStream dis=new DataInputStream(new GZIPInputStream(inputStream));
              IOUtils.copyBytes(dis,outputStream,DTOutput.this.conf);
            }
 catch (            IOException e) {
              LOG.warn("String_Node_Str",e);
            }
          }
 else {
            saveTmpModelToHDFS(currentIteration,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));
            int subTreesSize=subTrees.size();
            if (!isHalt && currentIteration != totalIteration) {
              Path tmpModelPath=getTmpModelPath(subTreesSize);
              writeModelToFileSystem(subTrees,out);
              LOG.info("String_Node_Str",tmpModelPath.toString());
              try {
                DataOutputStream outputStream=new DataOutputStream(new GZIPOutputStream(FileSystem.get(DTOutput.this.conf).create(tmpModelPath)));
                FSDataInputStream inputStream=FileSystem.get(DTOutput.this.conf).open(out);
                DataInputStream dis=new DataInputStream(new GZIPInputStream(inputStream));
                IOUtils.copyBytes(dis,outputStream,DTOutput.this.conf);
              }
 catch (              IOException e) {
                LOG.warn("String_Node_Str",e);
              }
            }
 else {
              saveTmpModelToHDFS(subTreesSize,subTrees);
            }
          }
        }
,"String_Node_Str");
        tmpModelPersistThread.setDaemon(true);
        tmpModelPersistThread.start();
      }
    }
  }
  updateProgressLog(context);
  LOG.debug("String_Node_Str",(System.currentTimeMillis() - start));
}