Program: 173298
Project: 173298
Buggy source:
private static ResourcePlan createResourcePlan(Config config){
  ResourcePlan resourcePlan=new ResourcePlan(SlurmMPIContext.clusterName(config));
  try {
    String processName=MPI.getProcessorName();
    char[] processNameChars=new char[processName.length()];
    int length=processNameChars.length;
    processName.getChars(0,length,processNameChars,0);
    IntBuffer countSend=MPI.newIntBuffer(1);
    int worldSize=MPI.COMM_WORLD.getSize();
    IntBuffer countReceive=MPI.newIntBuffer(worldSize);
    countSend.put(length);
    MPI.COMM_WORLD.allGather(countSend,1,MPI.INT,countReceive,MPI.COMM_WORLD.getSize(),MPI.INT);
    int[] receiveSizes=new int[worldSize];
    int[] displacements=new int[worldSize];
    int sum=0;
    for (int i=0; i < worldSize; i++) {
      receiveSizes[i]=countReceive.get(i);
      displacements[i]=sum;
      sum+=receiveSizes[i];
    }
    MPI.COMM_WORLD.allGather(countSend,1,MPI.INT,countReceive,worldSize,MPI.INT);
    CharBuffer sendBuffer=MPI.newCharBuffer(length);
    CharBuffer receiveBuffer=MPI.newCharBuffer(countReceive.get());
    sendBuffer.append(processName);
    MPI.COMM_WORLD.allGatherv(sendBuffer,length,MPI.CHAR,receiveBuffer,receiveSizes,displacements,MPI.CHAR);
    Map<Integer,String> processNames=new HashMap<>();
    for (int i=0; i < receiveSizes.length; i++) {
      char[] c=new char[receiveSizes[i]];
      receiveBuffer.get(c);
      processNames.put(i,new String(c));
      LOG.info(String.format("String_Node_Str",i,processNames.get(i)));
    }
    addContainers(config,resourcePlan,processNames);
  }
 catch (  MPIException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  return resourcePlan;
}

Fixed version (ground truth):
private static ResourcePlan createResourcePlan(Config config){
  try {
    ResourcePlan resourcePlan=new ResourcePlan(SlurmMPIContext.clusterName(config),MPI.COMM_WORLD.getRank());
    String processName=MPI.getProcessorName();
    char[] processNameChars=new char[processName.length()];
    int length=processNameChars.length;
    processName.getChars(0,length,processNameChars,0);
    IntBuffer countSend=MPI.newIntBuffer(1);
    int worldSize=MPI.COMM_WORLD.getSize();
    IntBuffer countReceive=MPI.newIntBuffer(worldSize);
    countSend.put(length);
    MPI.COMM_WORLD.allGather(countSend,1,MPI.INT,countReceive,MPI.COMM_WORLD.getSize(),MPI.INT);
    int[] receiveSizes=new int[worldSize];
    int[] displacements=new int[worldSize];
    int sum=0;
    for (int i=0; i < worldSize; i++) {
      receiveSizes[i]=countReceive.get(i);
      displacements[i]=sum;
      sum+=receiveSizes[i];
    }
    MPI.COMM_WORLD.allGather(countSend,1,MPI.INT,countReceive,worldSize,MPI.INT);
    CharBuffer sendBuffer=MPI.newCharBuffer(length);
    CharBuffer receiveBuffer=MPI.newCharBuffer(countReceive.get());
    sendBuffer.append(processName);
    MPI.COMM_WORLD.allGatherv(sendBuffer,length,MPI.CHAR,receiveBuffer,receiveSizes,displacements,MPI.CHAR);
    Map<Integer,String> processNames=new HashMap<>();
    for (int i=0; i < receiveSizes.length; i++) {
      char[] c=new char[receiveSizes[i]];
      receiveBuffer.get(c);
      processNames.put(i,new String(c));
      LOG.info(String.format("String_Node_Str",i,processNames.get(i)));
    }
    addContainers(config,resourcePlan,processNames);
    return resourcePlan;
  }
 catch (  MPIException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}