Program: 13741
Project: 13741
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 (subtractAM) {
    tmpmem-=MEM_AM;
    tmpvcores-=VCORES_AM;
  }
  if (opt.setMapContainers)   opt.mapsPerContainer=Math.min(tmpvcores,Math.max(tmpmem / RESOURCE_REQ[type][0],1));
  if (opt.setReduceContainers)   opt.reducersPerContainer=Math.min(tmpvcores,Math.max(tmpmem / RESOURCE_REQ[type][1],1));
  opt.maps=Math.max(1,opt.nodes * opt.mapsPerContainer);
  opt.mthreads=Math.max(1,tmpvcores / opt.mapsPerContainer);
  opt.rthreads=Math.max(1,tmpvcores / opt.reducersPerContainer);
  int mmem=RESOURCE_REQ[type][0];
  int rmem=RESOURCE_REQ[type][1] == ALL ? tmpmem : RESOURCE_REQ[type][1];
  Logger.DEBUG("String_Node_Str" + opt.mapsPerContainer + "String_Node_Str"+ opt.mthreads+ "String_Node_Str"+ mmem+ "String_Node_Str"+ opt.reducersPerContainer+ "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" + opt.rthreads);
  conf.set("String_Node_Str","String_Node_Str" + rmem);
  conf.set("String_Node_Str","String_Node_Str" + mmem);
  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;
  if (subtractAM) {
    tmpmem-=MEM_AM;
    tmpvcores-=VCORES_AM;
  }
  if (opt.setMapContainers)   opt.mapsPerContainer=Math.min(tmpvcores / 2,Math.max(tmpmem / RESOURCE_REQ[type][0],1));
  if (opt.setReduceContainers)   opt.reducersPerContainer=Math.min(tmpvcores,Math.max(tmpmem / RESOURCE_REQ[type][1],1));
  opt.maps=Math.max(1,opt.nodes * opt.mapsPerContainer);
  opt.mthreads=Math.max(1,tmpvcores / opt.mapsPerContainer);
  opt.rthreads=Math.max(1,tmpvcores / opt.reducersPerContainer);
  int mmem=RESOURCE_REQ[type][0];
  int rmem=RESOURCE_REQ[type][1] == ALL ? tmpmem : RESOURCE_REQ[type][1];
  Logger.DEBUG("String_Node_Str" + opt.mapsPerContainer + "String_Node_Str"+ opt.mthreads+ "String_Node_Str"+ mmem+ "String_Node_Str"+ opt.reducersPerContainer+ "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" + opt.rthreads);
  conf.set("String_Node_Str","String_Node_Str" + rmem);
  conf.set("String_Node_Str","String_Node_Str" + mmem);
  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);
}