Program: 5881
Project: 5881
Buggy source:
@Override public void run(){
  while (true) {
    try {
      if (writeListMap.isEmpty()) {
        int messages=0;
        long limitKey=(System.currentTimeMillis() / eventBucketIntervalMs) - maxNumberOfBucketsInTable;
synchronized (messageTable) {
          SortedSet<Long> rowKeySet=messageTable.rowKeySet();
          if (!rowKeySet.isEmpty()) {
            int numBuckets=rowKeySet.size();
            long oldestBucketKey=rowKeySet.first();
            Map<String,Entry<Long,List<KafkaLogEvent>>> row=messageTable.row(oldestBucketKey);
            for (Iterator<Map.Entry<String,Entry<Long,List<KafkaLogEvent>>>> it=row.entrySet().iterator(); it.hasNext(); ) {
              Map.Entry<String,Entry<Long,List<KafkaLogEvent>>> mapEntry=it.next();
              if (numBuckets < maxNumberOfBucketsInTable && limitKey < mapEntry.getValue().getKey()) {
                break;
              }
              writeListMap.putAll(mapEntry.getKey(),mapEntry.getValue().getValue());
              messages+=mapEntry.getValue().getValue().size();
              it.remove();
            }
          }
        }
        LOG.trace("String_Node_Str",messages);
      }
      long sleepTimeNanos=writeListMap.isEmpty() ? SLEEP_TIME_NS : 1;
      if (stopLatch.await(sleepTimeNanos,TimeUnit.NANOSECONDS)) {
        LOG.debug("String_Node_Str");
        return;
      }
 else {
        LOG.trace("String_Node_Str",sleepTimeNanos);
      }
      for (Iterator<Entry<String,Collection<KafkaLogEvent>>> it=writeListMap.asMap().entrySet().iterator(); it.hasNext(); ) {
        Entry<String,Collection<KafkaLogEvent>> mapEntry=it.next();
        List<KafkaLogEvent> list=(List<KafkaLogEvent>)mapEntry.getValue();
        Collections.sort(list);
        logFileWriter.append(list);
        it.remove();
      }
      exponentialBackoff.reset();
    }
 catch (    Throwable e) {
      LOG.error("String_Node_Str",e);
      try {
        exponentialBackoff.backoff();
      }
 catch (      InterruptedException e1) {
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (true) {
    try {
      if (writeListMap.isEmpty()) {
        int messages=0;
        long limitKey=(System.currentTimeMillis() / eventBucketIntervalMs) - maxNumberOfBucketsInTable;
synchronized (messageTable) {
          SortedSet<Long> rowKeySet=messageTable.rowKeySet();
          if (!rowKeySet.isEmpty()) {
            int numBuckets=rowKeySet.size();
            long oldestBucketKey=rowKeySet.first();
            Map<String,Entry<Long,List<KafkaLogEvent>>> row=messageTable.row(oldestBucketKey);
            for (Iterator<Map.Entry<String,Entry<Long,List<KafkaLogEvent>>>> it=row.entrySet().iterator(); it.hasNext(); ) {
              Map.Entry<String,Entry<Long,List<KafkaLogEvent>>> mapEntry=it.next();
              if (numBuckets < maxNumberOfBucketsInTable && limitKey < mapEntry.getValue().getKey()) {
                break;
              }
              writeListMap.putAll(mapEntry.getKey(),mapEntry.getValue().getValue());
              messages+=mapEntry.getValue().getValue().size();
              it.remove();
            }
          }
        }
        LOG.trace("String_Node_Str",messages);
      }
      long sleepTimeNanos=writeListMap.isEmpty() ? SLEEP_TIME_NS : 1;
      if (stopLatch.await(sleepTimeNanos,TimeUnit.NANOSECONDS)) {
        LOG.debug("String_Node_Str");
        return;
      }
 else {
        LOG.trace("String_Node_Str",sleepTimeNanos);
      }
      for (Iterator<Entry<String,Collection<KafkaLogEvent>>> it=writeListMap.asMap().entrySet().iterator(); it.hasNext(); ) {
        Entry<String,Collection<KafkaLogEvent>> mapEntry=it.next();
        List<KafkaLogEvent> list=(List<KafkaLogEvent>)mapEntry.getValue();
        Collections.sort(list);
        logFileWriter.append(list);
        it.remove();
      }
      logFileWriter.flush(false);
      exponentialBackoff.reset();
    }
 catch (    Throwable e) {
      LOG.error("String_Node_Str",e);
      try {
        exponentialBackoff.backoff();
      }
 catch (      InterruptedException e1) {
      }
    }
  }
}