Program: 79485
Project: 79485
Buggy source:
private void persistNow(){
  if (isActive()) {
    try {
      DeltaCollector prevDeltaCollector;
synchronized (this) {
        prevDeltaCollector=deltaCollector;
        deltaCollector=new DeltaCollector();
      }
      if (prevDeltaCollector.isEmpty()) {
        if (LOG.isTraceEnabled())         LOG.trace("String_Node_Str");
      }
 else {
        PersisterDeltaImpl persisterDelta=new PersisterDeltaImpl();
        for (        Location location : prevDeltaCollector.locations) {
          try {
            persisterDelta.locations.add(((LocationInternal)location).getRebindSupport().getMemento());
          }
 catch (          Exception e) {
            handleGenerateMementoException(e,"String_Node_Str" + location.getClass().getSimpleName() + "String_Node_Str"+ location.getId()+ "String_Node_Str");
          }
        }
        for (        Entity entity : prevDeltaCollector.entities) {
          try {
            persisterDelta.entities.add(((EntityInternal)entity).getRebindSupport().getMemento());
          }
 catch (          Exception e) {
            handleGenerateMementoException(e,"String_Node_Str" + entity.getEntityType().getSimpleName() + "String_Node_Str"+ entity.getId()+ "String_Node_Str");
          }
        }
        for (        Policy policy : prevDeltaCollector.policies) {
          try {
            persisterDelta.policies.add(policy.getRebindSupport().getMemento());
          }
 catch (          Exception e) {
            handleGenerateMementoException(e,"String_Node_Str" + policy.getClass().getSimpleName() + "String_Node_Str"+ policy.getId()+ "String_Node_Str");
          }
        }
        for (        Enricher enricher : prevDeltaCollector.enrichers) {
          try {
            persisterDelta.enrichers.add(enricher.getRebindSupport().getMemento());
          }
 catch (          Exception e) {
            handleGenerateMementoException(e,"String_Node_Str" + enricher.getClass().getSimpleName() + "String_Node_Str"+ enricher.getId()+ "String_Node_Str");
          }
        }
        persisterDelta.removedLocationIds=prevDeltaCollector.removedLocationIds;
        persisterDelta.removedEntityIds=prevDeltaCollector.removedEntityIds;
        persisterDelta.removedPolicyIds=prevDeltaCollector.removedPolicyIds;
        persisterDelta.removedEnricherIds=prevDeltaCollector.removedEnricherIds;
synchronized (new Object()) {
        }
        persister.delta(persisterDelta);
      }
    }
 catch (    Exception e) {
      if (isActive()) {
        throw Exceptions.propagate(e);
      }
 else {
        Exceptions.propagateIfFatal(e);
        LOG.debug("String_Node_Str",e);
      }
    }
 finally {
      writeCount.incrementAndGet();
    }
  }
}

Fixed version (ground truth):
@VisibleForTesting public void persistNow(){
  if (!isActive())   return;
  try {
    persistingMutex.acquire();
    if (!isActive())     return;
    DeltaCollector prevDeltaCollector;
synchronized (this) {
      prevDeltaCollector=deltaCollector;
      deltaCollector=new DeltaCollector();
    }
    if (prevDeltaCollector.isEmpty()) {
      if (LOG.isTraceEnabled())       LOG.trace("String_Node_Str");
    }
 else {
      PersisterDeltaImpl persisterDelta=new PersisterDeltaImpl();
      for (      Location location : prevDeltaCollector.locations) {
        try {
          persisterDelta.locations.add(((LocationInternal)location).getRebindSupport().getMemento());
        }
 catch (        Exception e) {
          handleGenerateMementoException(e,"String_Node_Str" + location.getClass().getSimpleName() + "String_Node_Str"+ location.getId()+ "String_Node_Str");
        }
      }
      for (      Entity entity : prevDeltaCollector.entities) {
        try {
          persisterDelta.entities.add(((EntityInternal)entity).getRebindSupport().getMemento());
        }
 catch (        Exception e) {
          handleGenerateMementoException(e,"String_Node_Str" + entity.getEntityType().getSimpleName() + "String_Node_Str"+ entity.getId()+ "String_Node_Str");
        }
      }
      for (      Policy policy : prevDeltaCollector.policies) {
        try {
          persisterDelta.policies.add(policy.getRebindSupport().getMemento());
        }
 catch (        Exception e) {
          handleGenerateMementoException(e,"String_Node_Str" + policy.getClass().getSimpleName() + "String_Node_Str"+ policy.getId()+ "String_Node_Str");
        }
      }
      for (      Enricher enricher : prevDeltaCollector.enrichers) {
        try {
          persisterDelta.enrichers.add(enricher.getRebindSupport().getMemento());
        }
 catch (        Exception e) {
          handleGenerateMementoException(e,"String_Node_Str" + enricher.getClass().getSimpleName() + "String_Node_Str"+ enricher.getId()+ "String_Node_Str");
        }
      }
      persisterDelta.removedLocationIds=prevDeltaCollector.removedLocationIds;
      persisterDelta.removedEntityIds=prevDeltaCollector.removedEntityIds;
      persisterDelta.removedPolicyIds=prevDeltaCollector.removedPolicyIds;
      persisterDelta.removedEnricherIds=prevDeltaCollector.removedEnricherIds;
synchronized (new Object()) {
      }
      persister.delta(persisterDelta);
    }
  }
 catch (  Exception e) {
    if (isActive()) {
      throw Exceptions.propagate(e);
    }
 else {
      Exceptions.propagateIfFatal(e);
      LOG.debug("String_Node_Str",e);
    }
  }
 finally {
    writeCount.incrementAndGet();
    persistingMutex.release();
  }
}