Program: 172996
Project: 172996
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 (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();
  boolean canProgress=true;
  while (sendRequestsIterator.hasNext() && canProgress) {
    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();
        }
 else {
          canProgress=false;
          break;
        }
      }
 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 (false) {
    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");
          }
        }
 else {
          break;
        }
      }
    }
 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();
  boolean canProgress=true;
  while (sendRequestsIterator.hasNext() && canProgress) {
    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();
        }
 else {
          canProgress=false;
          break;
        }
      }
 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");
          }
        }
 else {
          break;
        }
      }
    }
 catch (    MPIException e) {
      LOG.log(Level.SEVERE,"String_Node_Str",e);
      throw new RuntimeException("String_Node_Str",e);
    }
  }
}