Program: 13764
Project: 13764
Buggy source:
public static void setJobResources(HalvadeOptions opt,Configuration conf,int type,boolean subtractAM){
  int tmpmem=(int)(opt.mem * 1024);
  int tmpvcores=opt.vcores;
  if (opt.setMapContainers)   opt.mapContainersPerNode=Math.min(tmpvcores,Math.max(tmpmem / RESOURCE_REQ[type][0],1));
  if (opt.setReduceContainers)   opt.reducerContainersPerNode=Math.min(tmpvcores,Math.max(tmpmem / RESOURCE_REQ[type][1],1));
  opt.maps=Math.max(1,opt.nodes * opt.mapContainersPerNode);
  Logger.DEBUG("String_Node_Str" + opt.maps);
  HalvadeConf.setMapContainerCount(conf,opt.maps);
  HalvadeConf.setVcores(conf,opt.vcores);
  opt.mthreads=Math.max(1,tmpvcores / opt.mapContainersPerNode);
  opt.rthreads=Math.max(1,tmpvcores / opt.reducerContainersPerNode);
  if (opt.smtEnabled) {
    opt.mthreads*=2;
    opt.rthreads*=2;
  }
  int mmem=RESOURCE_REQ[type][0];
  int rmem=RESOURCE_REQ[type][1] == ALL ? tmpmem - MEM_AM : RESOURCE_REQ[type][1];
  if (type == DNA) {
    if (opt.overrideMem > 0) {
      mmem=opt.overrideMem;
      rmem=opt.overrideMem;
    }
  }
  Logger.DEBUG("String_Node_Str" + opt.mapContainersPerNode + "String_Node_Str"+ opt.mthreads+ "String_Node_Str"+ mmem+ "String_Node_Str"+ opt.reducerContainersPerNode+ "String_Node_Str"+ opt.rthreads+ "String_Node_Str"+ rmem+ "String_Node_Str");
  conf.set("String_Node_Str","String_Node_Str" + opt.mthreads);
  conf.set("String_Node_Str","String_Node_Str" + mmem);
  if (subtractAM)   conf.set("String_Node_Str","String_Node_Str" + (opt.rthreads - VCORES_AM));
 else   conf.set("String_Node_Str","String_Node_Str" + opt.rthreads);
  conf.set("String_Node_Str","String_Node_Str" + rmem);
  conf.set("String_Node_Str","String_Node_Str" + (int)(0.8 * rmem) + "String_Node_Str");
  conf.set("String_Node_Str","String_Node_Str" + (int)(0.8 * mmem) + "String_Node_Str");
  conf.set("String_Node_Str","String_Node_Str");
  HalvadeConf.setMapThreads(conf,opt.mthreads);
  HalvadeConf.setReducerThreads(conf,opt.rthreads);
}

Fixed version (ground truth):
public static void setJobResources(HalvadeOptions opt,Configuration conf,int type,boolean subtractAM){
  int tmpmem=(int)(opt.mem * 1024);
  int tmpvcores=opt.vcores;
  int mmem=RESOURCE_REQ[type][0];
  int rmem=RESOURCE_REQ[type][1] == ALL ? tmpmem - MEM_AM : RESOURCE_REQ[type][1];
  if (type == DNA && opt.overrideMem > 0) {
    mmem=opt.overrideMem;
    rmem=opt.overrideMem;
  }
  if (opt.setMapContainers)   opt.mapContainersPerNode=Math.min(tmpvcores,Math.max(tmpmem / mmem,1));
  if (opt.setReduceContainers)   opt.reducerContainersPerNode=Math.min(tmpvcores,Math.max(tmpmem / rmem,1));
  opt.maps=Math.max(1,opt.nodes * opt.mapContainersPerNode);
  Logger.DEBUG("String_Node_Str" + opt.maps);
  HalvadeConf.setMapContainerCount(conf,opt.maps);
  HalvadeConf.setVcores(conf,opt.vcores);
  opt.mthreads=Math.max(1,tmpvcores / opt.mapContainersPerNode);
  opt.rthreads=Math.max(1,tmpvcores / opt.reducerContainersPerNode);
  if (opt.smtEnabled) {
    opt.mthreads*=2;
    opt.rthreads*=2;
  }
  Logger.DEBUG("String_Node_Str" + opt.mapContainersPerNode + "String_Node_Str"+ opt.mthreads+ "String_Node_Str"+ mmem+ "String_Node_Str"+ opt.reducerContainersPerNode+ "String_Node_Str"+ opt.rthreads+ "String_Node_Str"+ rmem+ "String_Node_Str");
  conf.set("String_Node_Str","String_Node_Str" + opt.mthreads);
  conf.set("String_Node_Str","String_Node_Str" + mmem);
  if (subtractAM)   conf.set("String_Node_Str","String_Node_Str" + (opt.rthreads - VCORES_AM));
 else   conf.set("String_Node_Str","String_Node_Str" + opt.rthreads);
  conf.set("String_Node_Str","String_Node_Str" + rmem);
  conf.set("String_Node_Str","String_Node_Str" + (int)(0.8 * rmem) + "String_Node_Str");
  conf.set("String_Node_Str","String_Node_Str" + (int)(0.8 * mmem) + "String_Node_Str");
  conf.set("String_Node_Str","String_Node_Str");
  HalvadeConf.setMapThreads(conf,opt.mthreads);
  HalvadeConf.setReducerThreads(conf,opt.rthreads);
}