Program: 173069
Project: 173069
Buggy source:
/** 
 * Progress the communications that are pending
 */
public void progress(){
  while (pendingSends.size() > 0) {
    MPISendRequests sendRequests=pendingSends.poll();
    if (sendRequests != null) {
      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) {
          completedSendCount++;
          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()) {
            ++receiveCount;
            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.log(Level.SEVERE,"String_Node_Str",e);
      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();
    if (sendRequests != null) {
      postMessage(sendRequests);
      waitForCompletionSends.add(sendRequests);
    }
  }
  for (int i=0; i < registeredReceives.size(); i++) {
    MPIReceiveRequests receiveRequests=registeredReceives.get(i);
    if (debug) {
      LOG.info(String.format("String_Node_Str",executor,receiveRequests.rank,receiveRequests.availableBuffers.size(),receiveRequests.availableBuffers.peek()));
    }
    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) {
          completedSendCount++;
          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();
    }
  }
  if (debug) {
    LOG.info(String.format("String_Node_Str",executor,sendCount,completedSendCount,receiveCount,pendingReceiveCount,pendingSends.size(),waitForCompletionSends.size()));
  }
  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()) {
            ++receiveCount;
            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.log(Level.SEVERE,"String_Node_Str",e);
      throw new RuntimeException("String_Node_Str",e);
    }
  }
}