Program: 49700
Project: 49700
Buggy source:
boolean startCleanup(boolean forced){
  if (cleanupActive.compareAndSet(false,true)) {
    try {
      final long now=System.currentTimeMillis();
      if (nearCache != null) {
        nearCache.evict(now,false);
      }
      final Set<Record> recordsDirty=new HashSet<Record>();
      final Set<Record> recordsUnknown=new HashSet<Record>();
      final Set<Record> recordsToPurge=new HashSet<Record>();
      final Set<Record> recordsToEvict=new HashSet<Record>();
      final Set<Record> sortedRecords=new TreeSet<Record>(new ComparatorWrapper(evictionComparator));
      final Collection<Record> records=mapRecords.values();
      final boolean overCapacity=maxSizePolicy.overCapacity();
      final boolean evictionAware=evictionComparator != null && overCapacity;
      int recordsStillOwned=0;
      int backupPurgeCount=0;
      PartitionManager partitionManager=concurrentMapManager.partitionManager;
      for (      Record record : records) {
        PartitionInfo partition=partitionManager.getPartition(record.getBlockId());
        Address owner=partition.getOwner();
        boolean owned=(owner != null && thisAddress.equals(owner));
        boolean ownedOrBackup=partition.isOwnerOrBackup(thisAddress,backupCount);
        if (owner != null && !partitionManager.isMigrating(partition.getPartitionId())) {
          if (owned) {
            if (store != null && writeDelayMillis > 0 && record.isDirty()) {
              if (now > record.getWriteTime()) {
                recordsDirty.add(record);
                record.setDirty(false);
              }
            }
 else             if (shouldPurgeRecord(record,now)) {
              recordsToPurge.add(record);
            }
 else             if (record.isActive() && !record.isValid(now)) {
              recordsToEvict.add(record);
            }
 else             if (evictionAware && record.isActive() && record.isEvictable()) {
              sortedRecords.add(record);
              recordsStillOwned++;
            }
          }
 else           if (ownedOrBackup) {
            if (shouldPurgeRecord(record,now)) {
              recordsToPurge.add(record);
              backupPurgeCount++;
            }
          }
 else {
            recordsUnknown.add(record);
          }
        }
      }
      if (evictionAware && (forced || overCapacity)) {
        int numberOfRecordsToEvict=(int)(recordsStillOwned * evictionRate);
        int evictedCount=0;
        for (        Record record : sortedRecords) {
          if (record.isActive() && record.isEvictable()) {
            recordsToEvict.add(record);
            if (++evictedCount >= numberOfRecordsToEvict) {
              break;
            }
          }
        }
      }
      Level levelLog=(concurrentMapManager.LOG_STATE) ? Level.INFO : Level.FINEST;
      logger.log(levelLog,name + "String_Node_Str" + "String_Node_Str"+ recordsDirty.size()+ "String_Node_Str"+ recordsToPurge.size()+ "String_Node_Str"+ recordsToEvict.size()+ "String_Node_Str"+ recordsUnknown.size()+ "String_Node_Str"+ recordsStillOwned+ "String_Node_Str"+ backupPurgeCount);
      executeStoreUpdate(recordsDirty);
      executeEviction(recordsToEvict);
      executePurge(recordsToPurge);
      executePurgeUnknowns(recordsUnknown);
    }
  finally {
      cleanupActive.set(false);
      return true;
    }
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
boolean startCleanup(boolean forced){
  if (cleanupActive.compareAndSet(false,true)) {
    try {
      final long now=System.currentTimeMillis();
      if (nearCache != null) {
        nearCache.evict(now,false);
      }
      final Set<Record> recordsDirty=new HashSet<Record>();
      final Set<Record> recordsUnknown=new HashSet<Record>();
      final Set<Record> recordsToPurge=new HashSet<Record>();
      final Set<Record> recordsToEvict=new HashSet<Record>();
      final Set<Record> sortedRecords=new TreeSet<Record>(new ComparatorWrapper(evictionComparator));
      final Collection<Record> records=mapRecords.values();
      final boolean overCapacity=maxSizePolicy.overCapacity();
      final boolean evictionAware=evictionComparator != null && overCapacity;
      int recordsStillOwned=0;
      int backupPurgeCount=0;
      PartitionManager partitionManager=concurrentMapManager.partitionManager;
      for (      Record record : records) {
        PartitionInfo partition=partitionManager.getPartition(record.getBlockId());
        Address owner=partition.getOwner();
        boolean owned=(owner != null && thisAddress.equals(owner));
        boolean ownedOrBackup=partition.isOwnerOrBackup(thisAddress,backupCount);
        if (owner != null && !partitionManager.isPartitionMigrating(partition.getPartitionId())) {
          if (owned) {
            if (store != null && writeDelayMillis > 0 && record.isDirty()) {
              if (now > record.getWriteTime()) {
                recordsDirty.add(record);
                record.setDirty(false);
              }
            }
 else             if (shouldPurgeRecord(record,now)) {
              recordsToPurge.add(record);
            }
 else             if (record.isActive() && !record.isValid(now)) {
              recordsToEvict.add(record);
            }
 else             if (evictionAware && record.isActive() && record.isEvictable()) {
              sortedRecords.add(record);
              recordsStillOwned++;
            }
          }
 else           if (ownedOrBackup) {
            if (shouldPurgeRecord(record,now)) {
              recordsToPurge.add(record);
              backupPurgeCount++;
            }
          }
 else {
            recordsUnknown.add(record);
          }
        }
      }
      if (evictionAware && (forced || overCapacity)) {
        int numberOfRecordsToEvict=(int)(recordsStillOwned * evictionRate);
        int evictedCount=0;
        for (        Record record : sortedRecords) {
          if (record.isActive() && record.isEvictable()) {
            recordsToEvict.add(record);
            if (++evictedCount >= numberOfRecordsToEvict) {
              break;
            }
          }
        }
      }
      Level levelLog=(concurrentMapManager.LOG_STATE) ? Level.INFO : Level.FINEST;
      logger.log(levelLog,name + "String_Node_Str" + "String_Node_Str"+ recordsDirty.size()+ "String_Node_Str"+ recordsToPurge.size()+ "String_Node_Str"+ recordsToEvict.size()+ "String_Node_Str"+ recordsUnknown.size()+ "String_Node_Str"+ recordsStillOwned+ "String_Node_Str"+ backupPurgeCount);
      executeStoreUpdate(recordsDirty);
      executeEviction(recordsToEvict);
      executePurge(recordsToPurge);
      executePurgeUnknowns(recordsUnknown);
    }
  finally {
      cleanupActive.set(false);
      return true;
    }
  }
 else {
    return false;
  }
}