Program: 175699
Project: 175699
Buggy source:
@Override public void run(){
  if (stateMachine.getRaftNode().getSnapshot().getIsInstallSnapshot().get()) {
    LOG.info("String_Node_Str");
    return;
  }
  if (!stateMachine.getRaftNode().getSnapshot().getIsTakeSnapshot().compareAndSet(false,true)) {
    LOG.info("String_Node_Str");
    return;
  }
  LOG.info("String_Node_Str");
  try {
    GlobalConf conf=GlobalConf.getInstance();
    Set<String> topicSet=topicLogMap.keySet();
    for (    String topic : topicSet) {
      ConcurrentMap<Integer,SegmentedLog> queueLogMap=topicLogMap.get(topic);
      if (queueLogMap != null) {
        Set<Integer> queueSet=queueLogMap.keySet();
        for (        Integer queue : queueSet) {
          try {
            SegmentedLog log=topicLogMap.get(topic).get(queue);
            log.getLock().lock();
            try {
              Segment lastSegment=null;
              Iterator<Map.Entry<Long,Segment>> iterator=log.getStartOffsetSegmentMap().entrySet().iterator();
              while (iterator.hasNext()) {
                Segment segment=iterator.next().getValue();
                if (lastSegment == null) {
                  lastSegment=segment;
                  continue;
                }
                BrokerMessage.MessageContent message=segment.read(segment.getStartOffset());
                if (System.currentTimeMillis() / 1000 - message.getCreateTime() / 1000 > conf.getExpiredLogDuration()) {
                  lastSegment.delete();
                  iterator.remove();
                }
 else {
                  break;
                }
                lastSegment=segment;
              }
            }
  finally {
              log.getLock().unlock();
            }
          }
 catch (          Exception ex) {
            LOG.warn("String_Node_Str");
          }
        }
      }
    }
  }
  finally {
    stateMachine.getRaftNode().getSnapshot().getIsTakeSnapshot().compareAndSet(true,false);
  }
  LOG.info("String_Node_Str");
  stateMachine.getRaftNode().takeSnapshot();
}

Fixed version (ground truth):
@Override public void run(){
  if (stateMachine.getRaftNode().getSnapshot().getIsInstallSnapshot().get()) {
    LOG.info("String_Node_Str");
    return;
  }
  if (!stateMachine.getRaftNode().getSnapshot().getIsTakeSnapshot().compareAndSet(false,true)) {
    LOG.info("String_Node_Str");
    return;
  }
  LOG.info("String_Node_Str");
  try {
    GlobalConf conf=GlobalConf.getInstance();
    Set<String> topicSet=topicLogMap.keySet();
    for (    String topic : topicSet) {
      ConcurrentMap<Integer,SegmentedLog> queueLogMap=topicLogMap.get(topic);
      if (queueLogMap != null) {
        Set<Integer> queueSet=queueLogMap.keySet();
        for (        Integer queue : queueSet) {
          try {
            SegmentedLog log=topicLogMap.get(topic).get(queue);
            log.getLock().lock();
            try {
              List<Long> deletedKeyList=new ArrayList<>();
              Segment lastSegment=null;
              Iterator<Map.Entry<Long,Segment>> iterator=log.getStartOffsetSegmentMap().entrySet().iterator();
              while (iterator.hasNext()) {
                Segment segment=iterator.next().getValue();
                if (lastSegment == null) {
                  lastSegment=segment;
                  continue;
                }
                BrokerMessage.MessageContent message=segment.read(segment.getStartOffset());
                if (System.currentTimeMillis() / 1000 - message.getCreateTime() / 1000 > conf.getExpiredLogDuration()) {
                  lastSegment.delete();
                  deletedKeyList.add(lastSegment.getStartOffset());
                }
 else {
                  break;
                }
                lastSegment=segment;
              }
              for (              Long startOffset : deletedKeyList) {
                log.getStartOffsetSegmentMap().remove(startOffset);
              }
            }
  finally {
              log.getLock().unlock();
            }
          }
 catch (          Exception ex) {
            LOG.warn("String_Node_Str");
          }
        }
      }
    }
  }
  finally {
    stateMachine.getRaftNode().getSnapshot().getIsTakeSnapshot().compareAndSet(true,false);
  }
  LOG.info("String_Node_Str");
  stateMachine.getRaftNode().takeSnapshot();
}