Program: 173109
Project: 173109
Buggy source:
@Override public void progress(){
  for (  int t : messages.keySet()) {
    if (batchDone.get(t)) {
      continue;
    }
    boolean canProgress=true;
    while (canProgress) {
      Map<Integer,List<Object>> messagePerTarget=messages.get(t);
      Map<Integer,Boolean> finishedForTarget=finished.get(t);
      Map<Integer,Integer> countMap=counts.get(t);
      LOG.info(String.format("String_Node_Str",executor,t,countMap,finishedForTarget));
      boolean found=true;
      boolean allFinished=true;
      for (      Map.Entry<Integer,List<Object>> e : messagePerTarget.entrySet()) {
        if (e.getValue().size() == 0 && !finishedForTarget.get(e.getKey())) {
          found=false;
          canProgress=false;
        }
        if (!finishedForTarget.get(e.getKey())) {
          allFinished=false;
        }
      }
      if (found) {
        Object previous=null;
        for (        Map.Entry<Integer,List<Object>> e : messagePerTarget.entrySet()) {
          List<Object> valueList=e.getValue();
          if (valueList.size() > 0) {
            if (previous == null) {
              previous=e.getValue().get(0);
            }
 else {
              Object current=e.getValue().get(0);
              previous=reduceFunction.reduce(previous,current);
            }
          }
        }
        int flags=0;
        boolean last;
        if (allFinished) {
          last=true;
          for (          Map.Entry<Integer,List<Object>> e : messagePerTarget.entrySet()) {
            List<Object> valueList=e.getValue();
            if (valueList.size() > 1) {
              last=false;
            }
          }
          if (last) {
            flags=MessageFlags.FLAGS_LAST;
          }
        }
        if (dataFlowOperation.sendPartial(t,previous,flags,destination)) {
          boolean allZero=true;
          for (          Map.Entry<Integer,List<Object>> e : messagePerTarget.entrySet()) {
            List<Object> value=e.getValue();
            if (value.size() > 0) {
              value.remove(0);
            }
            if (value.size() != 0) {
              allZero=false;
            }
          }
          for (          Map.Entry<Integer,Integer> e : countMap.entrySet()) {
            Integer i=e.getValue();
            e.setValue(i - 1);
          }
          if (allFinished && allZero) {
            batchDone.put(t,true);
            break;
          }
        }
 else {
          canProgress=false;
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void progress(){
  for (  int t : messages.keySet()) {
    if (batchDone.get(t)) {
      continue;
    }
    boolean canProgress=true;
    while (canProgress) {
      Map<Integer,List<Object>> messagePerTarget=messages.get(t);
      Map<Integer,Boolean> finishedForTarget=finished.get(t);
      Map<Integer,Integer> countMap=counts.get(t);
      Map<Integer,Integer> totalCountMap=totalCounts.get(t);
      boolean found=true;
      boolean allFinished=true;
      for (      Map.Entry<Integer,List<Object>> e : messagePerTarget.entrySet()) {
        if (e.getValue().size() == 0 && !finishedForTarget.get(e.getKey())) {
          found=false;
          canProgress=false;
        }
        if (!finishedForTarget.get(e.getKey())) {
          allFinished=false;
        }
      }
      if (found) {
        Object previous=null;
        for (        Map.Entry<Integer,List<Object>> e : messagePerTarget.entrySet()) {
          List<Object> valueList=e.getValue();
          if (valueList.size() > 0) {
            if (previous == null) {
              previous=e.getValue().get(0);
            }
 else {
              Object current=e.getValue().get(0);
              previous=reduceFunction.reduce(previous,current);
            }
          }
        }
        int flags=0;
        boolean last;
        if (allFinished) {
          last=true;
          for (          Map.Entry<Integer,List<Object>> e : messagePerTarget.entrySet()) {
            List<Object> valueList=e.getValue();
            if (valueList.size() > 1) {
              last=false;
            }
          }
          if (last) {
            flags=MessageFlags.FLAGS_LAST;
          }
        }
        if (dataFlowOperation.sendPartial(t,previous,flags,destination)) {
          boolean allZero=true;
          for (          Map.Entry<Integer,List<Object>> e : messagePerTarget.entrySet()) {
            List<Object> value=e.getValue();
            if (value.size() > 0) {
              value.remove(0);
            }
            if (value.size() != 0) {
              allZero=false;
            }
          }
          for (          Map.Entry<Integer,Integer> e : countMap.entrySet()) {
            Integer i=e.getValue();
            e.setValue(i - 1);
          }
          if (allFinished && allZero) {
            batchDone.put(t,true);
            break;
          }
        }
 else {
          canProgress=false;
        }
      }
    }
  }
}