Program: 173170
Project: 173170
Buggy source:
/** 
 * Progress the communications that are pending
 */
public void progress(){
  while (pendingSends.size() > 0) {
    MPISendRequests sendRequests=pendingSends.poll();
    postMessage(sendRequests);
    waitForCompletionSends.add(sendRequests);
  }
  for (int i=0; i < registeredReceives.size(); i++) {
    MPIReceiveRequests receiveRequests=registeredReceives.get(i);
    if (receiveRequests.availableBuffers.size() > 0) {
      postReceive(receiveRequests);
    }
  }
  Iterator<MPISendRequests> sendRequestsIterator=waitForCompletionSends.iterator();
  while (sendRequestsIterator.hasNext()) {
    MPISendRequests sendRequests=sendRequestsIterator.next();
    Iterator<MPIRequest> requestIterator=sendRequests.pendingSends.iterator();
    while (requestIterator.hasNext()) {
      MPIRequest r=requestIterator.next();
      try {
        Status status=r.request.testStatus();
        if (status != null) {
          requestIterator.remove();
        }
      }
 catch (      MPIException e) {
        throw new RuntimeException("String_Node_Str" + sendRequests.rank,e);
      }
    }
    if (sendRequests.pendingSends.size() == 0) {
      sendRequests.callback.onSendComplete(sendRequests.rank,sendRequests.edge,sendRequests.message);
      sendRequestsIterator.remove();
    }
  }
  for (int i=0; i < registeredReceives.size(); i++) {
    MPIReceiveRequests receiveRequests=registeredReceives.get(i);
    try {
      Iterator<MPIRequest> requestIterator=receiveRequests.pendingRequests.iterator();
      while (requestIterator.hasNext()) {
        MPIRequest r=requestIterator.next();
        Status status=r.request.testStatus();
        if (status != null) {
          if (!status.isCancelled()) {
            r.buffer.setSize(status.getCount(MPI.BYTE));
            receiveRequests.callback.onReceiveComplete(receiveRequests.rank,receiveRequests.edge,r.buffer);
            requestIterator.remove();
          }
 else {
            throw new RuntimeException("String_Node_Str");
          }
        }
      }
    }
 catch (    MPIException e) {
      LOG.severe("String_Node_Str");
      throw new RuntimeException("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Progress the communications that are pending
 */
public void progress(){
  while (pendingSends.size() > 0) {
    MPISendRequests sendRequests=pendingSends.poll();
    postMessage(sendRequests);
    waitForCompletionSends.add(sendRequests);
  }
  for (int i=0; i < registeredReceives.size(); i++) {
    MPIReceiveRequests receiveRequests=registeredReceives.get(i);
    if (receiveRequests.availableBuffers.size() > 0) {
      postReceive(receiveRequests);
    }
  }
  Iterator<MPISendRequests> sendRequestsIterator=waitForCompletionSends.iterator();
  while (sendRequestsIterator.hasNext()) {
    MPISendRequests sendRequests=sendRequestsIterator.next();
    Iterator<MPIRequest> requestIterator=sendRequests.pendingSends.iterator();
    while (requestIterator.hasNext()) {
      MPIRequest r=requestIterator.next();
      try {
        Status status=r.request.testStatus();
        if (status != null) {
          requestIterator.remove();
        }
      }
 catch (      MPIException e) {
        throw new RuntimeException("String_Node_Str" + sendRequests.rank,e);
      }
    }
    if (sendRequests.pendingSends.size() == 0) {
      sendRequests.callback.onSendComplete(sendRequests.rank,sendRequests.edge,sendRequests.message);
      sendRequestsIterator.remove();
    }
  }
  for (int i=0; i < registeredReceives.size(); i++) {
    MPIReceiveRequests receiveRequests=registeredReceives.get(i);
    try {
      Iterator<MPIRequest> requestIterator=receiveRequests.pendingRequests.iterator();
      while (requestIterator.hasNext()) {
        MPIRequest r=requestIterator.next();
        Status status=r.request.testStatus();
        if (status != null) {
          if (!status.isCancelled()) {
            LOG.info(String.format("String_Node_Str",executor,receiveRequests.rank,status.getCount(MPI.BYTE)));
            r.buffer.setSize(status.getCount(MPI.BYTE));
            receiveRequests.callback.onReceiveComplete(receiveRequests.rank,receiveRequests.edge,r.buffer);
            requestIterator.remove();
          }
 else {
            throw new RuntimeException("String_Node_Str");
          }
        }
      }
    }
 catch (    MPIException e) {
      LOG.severe("String_Node_Str");
      throw new RuntimeException("String_Node_Str",e);
    }
  }
}