Program: 91397
Project: 91397
Buggy source:
@Override public void run(){
  try {
    SocketChannel socketChannel=null;
    for (; ; ) {
      try {
        socketChannel=SocketChannel.open(new InetSocketAddress(clientPort.host,clientPort.port));
        LOG.info("String_Node_Str" + clientPort);
        socketChannel.socket().setReceiveBufferSize(8 * 1024);
        break;
      }
 catch (      ConnectException e) {
        if (socketChannel != null)         socketChannel.close();
        Thread.sleep(100);
      }
    }
    socketChannelRef.set(socketChannel);
    socketChannelEntryWriter.sendWelcomeMessage(socketChannel,map.lastModification(),map.getIdentifier());
    final SocketChannelEntryReader.WelcomeMessage welcomeMessage=socketChannelEntryReader.readWelcomeMessage(socketChannel);
    final ReplicatedSharedHashMap.ModificationIterator remoteModificationIterator=map.acquireModificationIterator(welcomeMessage.identifier);
    remoteModificationIterator.dirtyEntries(welcomeMessage.timeStamp);
    socketChannel.configureBlocking(false);
    final Selector selector=Selector.open();
    socketChannel.register(selector,SelectionKey.OP_READ | SelectionKey.OP_WRITE);
    while (!isClosed.get()) {
      final int n=selector.select();
      if (n == 0) {
        continue;
      }
      final Iterator it=selector.selectedKeys().iterator();
      while (it.hasNext()) {
        SelectionKey key=(SelectionKey)it.next();
        it.remove();
        try {
          if (!key.isValid()) {
            continue;
          }
          if (key.isReadable()) {
            final SocketChannel socketChannel0=(SocketChannel)key.channel();
            socketChannelEntryReader.readAll(socketChannel0);
          }
          if (key.isWritable()) {
            final SocketChannel socketChannel0=(SocketChannel)key.channel();
            socketChannelEntryWriter.writeAll(socketChannel0,remoteModificationIterator);
          }
        }
 catch (        Exception e) {
          if (!isClosed.get())           LOG.log(Level.SEVERE,"String_Node_Str",e);
          try {
            key.channel().close();
          }
 catch (          IOException ex) {
          }
        }
      }
    }
  }
 catch (  Exception e) {
    if (!isClosed.get()) {
      LOG.log(Level.SEVERE,"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    SocketChannel socketChannel=null;
    for (; ; ) {
      try {
        socketChannel=SocketChannel.open(new InetSocketAddress(clientPort.host,clientPort.port));
        LOG.info("String_Node_Str" + clientPort);
        socketChannel.socket().setReceiveBufferSize(8 * 1024);
        break;
      }
 catch (      ConnectException e) {
        if (socketChannel != null)         socketChannel.close();
        Thread.sleep(100);
      }
    }
    LOG.info("String_Node_Str" + map.getIdentifier());
    socketChannelRef.set(socketChannel);
    socketChannelEntryWriter.sendWelcomeMessage(socketChannel,map.lastModification(),map.getIdentifier());
    final SocketChannelEntryReader.Bootstrap bootstrap=socketChannelEntryReader.readWelcomeMessage(socketChannel);
    final ReplicatedSharedHashMap.ModificationIterator remoteModificationIterator=map.acquireModificationIterator(bootstrap.identifier);
    remoteModificationIterator.dirtyEntries(bootstrap.timeStamp);
    if (bootstrap.identifier == map.getIdentifier())     throw new IllegalStateException("String_Node_Str" + map.getIdentifier());
    LOG.info("String_Node_Str" + map.getIdentifier() + "String_Node_Str"+ bootstrap.identifier);
    socketChannel.configureBlocking(false);
    final Selector selector=Selector.open();
    socketChannel.register(selector,SelectionKey.OP_READ | SelectionKey.OP_WRITE);
    while (!isClosed.get()) {
      final int n=selector.select();
      if (n == 0) {
        continue;
      }
      final Iterator it=selector.selectedKeys().iterator();
      while (it.hasNext()) {
        SelectionKey key=(SelectionKey)it.next();
        it.remove();
        try {
          if (!key.isValid()) {
            continue;
          }
          if (key.isReadable()) {
            final SocketChannel socketChannel0=(SocketChannel)key.channel();
            socketChannelEntryReader.readAll(socketChannel0);
          }
          if (key.isWritable()) {
            final SocketChannel socketChannel0=(SocketChannel)key.channel();
            socketChannelEntryWriter.writeAll(socketChannel0,remoteModificationIterator);
          }
        }
 catch (        Exception e) {
          if (!isClosed.get())           LOG.log(Level.SEVERE,"String_Node_Str",e);
          try {
            key.channel().close();
          }
 catch (          IOException ex) {
          }
        }
      }
    }
  }
 catch (  Exception e) {
    if (!isClosed.get()) {
      LOG.log(Level.SEVERE,"String_Node_Str",e);
    }
  }
}