Program: 85979
Project: 85979
Buggy source:
private void executePeer(final PeerAddress address,final Peer peer,final boolean shouldConnect,final ExecuteBlockMode blockUntilRunning){
  final CountDownLatch latch=new CountDownLatch(1);
  peerPool.execute(new Runnable(){
    public void run(){
      try {
        if (shouldConnect) {
          log.info("String_Node_Str" + peer);
          peer.connect();
        }
        peers.add(peer);
        handleNewPeer(peer);
        if (blockUntilRunning == ExecuteBlockMode.WAIT_FOR_STARTUP)         latch.countDown();
        peer.run();
      }
 catch (      PeerException ex) {
        final Throwable cause=ex.getCause();
        if (cause instanceof SocketTimeoutException) {
          log.info("String_Node_Str" + peer + "String_Node_Str"+ cause.getMessage());
        }
 else         if (cause instanceof ConnectException) {
          log.info("String_Node_Str" + peer + "String_Node_Str"+ cause.getMessage());
        }
 else         if (cause instanceof IOException) {
          log.info("String_Node_Str" + peer + "String_Node_Str"+ cause.getMessage());
        }
 else {
          log.error("String_Node_Str" + peer,ex);
        }
      }
 finally {
        if (!running)         return;
        peer.disconnect();
        if (address != null)         inactives.add(address);
        if (peers.remove(peer))         handlePeerDeath(peer);
      }
    }
  }
);
  if (blockUntilRunning == ExecuteBlockMode.WAIT_FOR_STARTUP) {
    try {
      latch.await();
    }
 catch (    InterruptedException e) {
    }
  }
}

Fixed version (ground truth):
private void executePeer(final PeerAddress address,final Peer peer,final boolean shouldConnect,final ExecuteBlockMode blockUntilRunning){
  final CountDownLatch latch=new CountDownLatch(1);
  peerPool.execute(new Runnable(){
    public void run(){
      try {
        if (shouldConnect) {
          log.info("String_Node_Str" + peer);
          peer.connect();
        }
synchronized (PeerGroup.this) {
          if (!running) {
            peer.disconnect();
            return;
          }
          peers.add(peer);
        }
        handleNewPeer(peer);
        if (blockUntilRunning == ExecuteBlockMode.WAIT_FOR_STARTUP)         latch.countDown();
        peer.run();
      }
 catch (      PeerException ex) {
        final Throwable cause=ex.getCause();
        if (cause instanceof SocketTimeoutException) {
          log.info("String_Node_Str" + peer + "String_Node_Str"+ cause.getMessage());
        }
 else         if (cause instanceof ConnectException) {
          log.info("String_Node_Str" + peer + "String_Node_Str"+ cause.getMessage());
        }
 else         if (cause instanceof IOException) {
          log.info("String_Node_Str" + peer + "String_Node_Str"+ cause.getMessage());
        }
 else {
          log.error("String_Node_Str" + peer,ex);
        }
      }
 finally {
        if (!running)         return;
        peer.disconnect();
        if (address != null)         inactives.add(address);
        if (peers.remove(peer))         handlePeerDeath(peer);
      }
    }
  }
);
  if (blockUntilRunning == ExecuteBlockMode.WAIT_FOR_STARTUP) {
    try {
      latch.await();
    }
 catch (    InterruptedException e) {
    }
  }
}