Program: 79408
Project: 79408
Buggy source:
@Override protected void doStart(){
  setAttribute(IS_CLUSTER_INITIALIZED,false);
  super.doStart();
  connectSensors();
  setAttribute(BUCKET_CREATION_IN_PROGRESS,false);
  Tasks.setBlockingDetails("String_Node_Str");
  Time.sleep(getConfig(NODES_STARTED_STABILIZATION_DELAY));
  Optional<Set<Entity>> upNodes=Optional.<Set<Entity>>fromNullable(getAttribute(COUCHBASE_CLUSTER_UP_NODES));
  if (upNodes.isPresent() && !upNodes.get().isEmpty()) {
    Tasks.setBlockingDetails("String_Node_Str");
    Entity primaryNode=upNodes.get().iterator().next();
    ((EntityInternal)primaryNode).setAttribute(CouchbaseNode.IS_PRIMARY_NODE,true);
    setAttribute(COUCHBASE_PRIMARY_NODE,primaryNode);
    Set<Entity> serversToAdd=MutableSet.<Entity>copyOf(getUpNodes());
    if (serversToAdd.size() >= getQuorumSize() && serversToAdd.size() > 1) {
      log.info("String_Node_Str",new Object[]{serversToAdd.size(),getId(),getQuorumSize()});
      addServers(serversToAdd);
      try {
        Tasks.setBlockingDetails("String_Node_Str");
        Time.sleep(getConfig(DELAY_BEFORE_ADVERTISING_CLUSTER));
      }
  finally {
        Tasks.resetBlockingDetails();
      }
      ((CouchbaseNode)getPrimaryNode()).rebalance();
    }
 else     if (getQuorumSize() > 1) {
      log.warn(this + "String_Node_Str");
    }
    if (getConfig(CREATE_BUCKETS) != null) {
      try {
        Tasks.setBlockingDetails("String_Node_Str");
        createBuckets();
        DependentConfiguration.waitInTaskForAttributeReady(this,CouchbaseCluster.BUCKET_CREATION_IN_PROGRESS,Predicates.equalTo(false));
      }
  finally {
        Tasks.resetBlockingDetails();
      }
    }
    if (getConfig(REPLICATION) != null) {
      try {
        Tasks.setBlockingDetails("String_Node_Str");
        List<Map<String,Object>> replRules=getConfig(REPLICATION);
        for (        Map<String,Object> replRule : replRules) {
          DynamicTasks.queue(Effectors.invocation(getPrimaryNode(),CouchbaseNode.ADD_REPLICATION_RULE,replRule));
        }
        DynamicTasks.waitForLast();
      }
  finally {
        Tasks.resetBlockingDetails();
      }
    }
    setAttribute(IS_CLUSTER_INITIALIZED,true);
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override protected void doStart(){
  setAttribute(IS_CLUSTER_INITIALIZED,false);
  super.doStart();
  connectSensors();
  setAttribute(BUCKET_CREATION_IN_PROGRESS,false);
  Tasks.setBlockingDetails("String_Node_Str");
  Time.sleep(getConfig(NODES_STARTED_STABILIZATION_DELAY));
  Optional<Set<Entity>> upNodes=Optional.<Set<Entity>>fromNullable(getAttribute(COUCHBASE_CLUSTER_UP_NODES));
  if (upNodes.isPresent() && !upNodes.get().isEmpty()) {
    Tasks.setBlockingDetails("String_Node_Str");
    Entity primaryNode=upNodes.get().iterator().next();
    ((EntityInternal)primaryNode).setAttribute(CouchbaseNode.IS_PRIMARY_NODE,true);
    setAttribute(COUCHBASE_PRIMARY_NODE,primaryNode);
    Set<Entity> serversToAdd=MutableSet.<Entity>copyOf(getUpNodes());
    if (serversToAdd.size() >= getQuorumSize() && serversToAdd.size() > 1) {
      log.info("String_Node_Str",new Object[]{serversToAdd.size(),getId(),getQuorumSize()});
      addServers(serversToAdd);
      try {
        Tasks.setBlockingDetails("String_Node_Str");
        Time.sleep(getConfig(DELAY_BEFORE_ADVERTISING_CLUSTER));
      }
  finally {
        Tasks.resetBlockingDetails();
      }
      ((CouchbaseNode)getPrimaryNode()).rebalance();
    }
 else {
      if (getQuorumSize() > 1) {
        log.warn(this + "String_Node_Str");
      }
      if (!serversToAdd.isEmpty()) {
        ((EntityInternal)Iterables.getOnlyElement(serversToAdd)).setAttribute(CouchbaseNode.IS_IN_CLUSTER,true);
      }
    }
    if (getConfig(CREATE_BUCKETS) != null) {
      try {
        Tasks.setBlockingDetails("String_Node_Str");
        createBuckets();
        DependentConfiguration.waitInTaskForAttributeReady(this,CouchbaseCluster.BUCKET_CREATION_IN_PROGRESS,Predicates.equalTo(false));
      }
  finally {
        Tasks.resetBlockingDetails();
      }
    }
    if (getConfig(REPLICATION) != null) {
      try {
        Tasks.setBlockingDetails("String_Node_Str");
        List<Map<String,Object>> replRules=getConfig(REPLICATION);
        for (        Map<String,Object> replRule : replRules) {
          DynamicTasks.queue(Effectors.invocation(getPrimaryNode(),CouchbaseNode.ADD_REPLICATION_RULE,replRule));
        }
        DynamicTasks.waitForLast();
      }
  finally {
        Tasks.resetBlockingDetails();
      }
    }
    setAttribute(IS_CLUSTER_INITIALIZED,true);
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
}