Program: 61758
Project: 61758
Buggy source:
public void start(Group group,ContentKey startingKey){
  lastQueryTime=startingKey.getTime();
  channel=ChannelNameUtils.extractFromChannelUrl(group.getChannelUrl());
  ThreadFactory factory=new ThreadFactoryBuilder().setNameFormat("String_Node_Str" + group.getName() + "String_Node_Str").build();
  ExecutorService executorService=Executors.newSingleThreadExecutor(factory);
  executorService.submit(new Runnable(){
    ContentKey lastAdded=startingKey;
    @Override public void run(){
      try {
        doWork();
      }
 catch (      Exception e) {
        error.set(true);
        logger.warn("String_Node_Str" + channel,e);
      }
    }
    private void doWork(){
      while (!shouldExit.get()) {
        DateTime latestStableInChannel=getLatestStable();
        logger.trace("String_Node_Str",channel,lastQueryTime,latestStableInChannel);
        if (lastQueryTime.isBefore(latestStableInChannel)) {
          TimeUtil.Unit unit=getStepUnit(latestStableInChannel);
          logger.trace("String_Node_Str",channel,unit,lastQueryTime);
          Location location=Location.ALL;
          if (unit.equals(TimeUtil.Unit.SECONDS)) {
            location=Location.CACHE;
          }
          TimeQuery query=TimeQuery.builder().channelName(channel).startTime(lastQueryTime).unit(unit).location(location).build();
          query.trace(false);
          addKeys(channelService.queryByTime(query));
          lastQueryTime=lastQueryTime.plus(unit.getDuration());
        }
 else {
          Sleeper.sleep(1000);
        }
      }
    }
    private void addKeys(    Collection<ContentKey> keys){
      logger.trace("String_Node_Str",channel,keys);
      try {
        for (        ContentKey key : keys) {
          if (key.compareTo(lastAdded) > 0) {
            queue.put(key);
            lastAdded=key;
          }
        }
      }
 catch (      InterruptedException e) {
        logger.info("String_Node_Str" + e.getMessage());
        throw new RuntimeInterruptedException(e);
      }
    }
  }
);
}

Fixed version (ground truth):
public void start(Group group,ContentKey startingKey){
  channel=ChannelNameUtils.extractFromChannelUrl(group.getChannelUrl());
  queryGenerator=new QueryGenerator(startingKey.getTime(),channel);
  ThreadFactory factory=new ThreadFactoryBuilder().setNameFormat("String_Node_Str" + group.getName() + "String_Node_Str").build();
  ExecutorService executorService=Executors.newSingleThreadExecutor(factory);
  executorService.submit(new Runnable(){
    ContentKey lastAdded=startingKey;
    @Override public void run(){
      try {
        doWork();
      }
 catch (      Exception e) {
        error.set(true);
        logger.warn("String_Node_Str" + channel,e);
      }
    }
    private void doWork(){
      while (!shouldExit.get()) {
        TimeQuery timeQuery=queryGenerator.getQuery(getLatestStable());
        if (timeQuery != null) {
          addKeys(channelService.queryByTime(timeQuery));
        }
 else {
          Sleeper.sleep(1000);
        }
      }
    }
    private void addKeys(    Collection<ContentKey> keys){
      logger.trace("String_Node_Str",channel,keys);
      try {
        for (        ContentKey key : keys) {
          if (key.compareTo(lastAdded) > 0) {
            queue.put(key);
            lastAdded=key;
          }
        }
      }
 catch (      InterruptedException e) {
        logger.info("String_Node_Str" + e.getMessage());
        throw new RuntimeInterruptedException(e);
      }
    }
    private DateTime getLatestStable(){
      if (channelService.isReplicating(channel)) {
        Optional<ContentKey> latest=channelService.getLatest(channel,true,false);
        if (latest.isPresent()) {
          return latest.get().getTime();
        }
 else {
          return new DateTime(0);
        }
      }
 else {
        return TimeUtil.stable();
      }
    }
  }
);
}