Program: 91347
Project: 91347
Buggy source:
/** 
 * binds to the server socket and process data This method will block until interrupted
 * @throws Exception
 */
private void process() throws Exception {
  LOG.info("String_Node_Str" + port);
  ServerSocket serverSocket=serverChannel.socket();
  Selector selector=Selector.open();
  serverSocket.setReuseAddress(true);
  serverSocket.bind(new InetSocketAddress(port));
  serverChannel.configureBlocking(false);
  serverChannel.register(selector,SelectionKey.OP_ACCEPT);
  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();
      if (key.isAcceptable()) {
        final ServerSocketChannel server=(ServerSocketChannel)key.channel();
        final SocketChannel channel=server.accept();
        channel.configureBlocking(false);
        final SocketChannelEntryReader socketChannelEntryReader=new SocketChannelEntryReader(maxEntrySize,this.externalizable);
        final Bootstrap bootstrap=socketChannelEntryReader.readBootstrap(channel);
        final ModificationIterator remoteModificationIterator=map.acquireModificationIterator(bootstrap.identifier);
        remoteModificationIterator.dirtyEntries(bootstrap.timeStamp);
        final Attached attached=new Attached(socketChannelEntryReader,remoteModificationIterator);
        channel.register(selector,SelectionKey.OP_WRITE | SelectionKey.OP_READ,attached);
        if (bootstrap.identifier == map.getIdentifier())         throw new IllegalStateException("String_Node_Str" + map.getIdentifier());
        socketChannelEntryWriter.sendBootstrap(channel,map.lastModification(),localIdentifier);
        LOG.info("String_Node_Str" + map.getIdentifier() + "String_Node_Str"+ bootstrap.identifier);
      }
      try {
        if (key.isWritable()) {
          final SocketChannel socketChannel=(SocketChannel)key.channel();
          final Attached attachment=(Attached)key.attachment();
          socketChannelEntryWriter.writeAll(socketChannel,attachment.remoteModificationIterator);
        }
        if (key.isReadable()) {
          final SocketChannel socketChannel=(SocketChannel)key.channel();
          final Attached attachment=(Attached)key.attachment();
          attachment.socketChannelEntryReader.readAll(socketChannel);
        }
      }
 catch (      Exception e) {
        LOG.error("String_Node_Str",e);
        try {
          key.channel().close();
        }
 catch (        IOException ex) {
        }
      }
      it.remove();
    }
  }
}

Fixed version (ground truth):
/** 
 * binds to the server socket and process data This method will block until interrupted
 * @throws Exception
 */
private void process() throws Exception {
  LOG.info("String_Node_Str" + port);
  ServerSocket serverSocket=serverChannel.socket();
  Selector selector=Selector.open();
  serverSocket.setReuseAddress(true);
  serverSocket.bind(new InetSocketAddress(port));
  serverChannel.configureBlocking(false);
  serverChannel.register(selector,SelectionKey.OP_ACCEPT);
  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();
      if (key.isAcceptable()) {
        final ServerSocketChannel server=(ServerSocketChannel)key.channel();
        final SocketChannel channel=server.accept();
        channel.configureBlocking(false);
        final SocketChannelEntryReader socketChannelEntryReader=new SocketChannelEntryReader(maxEntrySize,this.externalizable);
        final Bootstrap bootstrap=socketChannelEntryReader.readBootstrap(channel);
        final ModificationIterator remoteModificationIterator=map.acquireModificationIterator(bootstrap.identifier);
        remoteModificationIterator.dirtyEntries(bootstrap.timeStamp);
        final Attached attached=new Attached(socketChannelEntryReader,remoteModificationIterator);
        channel.register(selector,SelectionKey.OP_WRITE | SelectionKey.OP_READ,attached);
        if (bootstrap.identifier == map.getIdentifier())         throw new IllegalStateException("String_Node_Str" + map.getIdentifier());
        socketChannelEntryWriter.sendBootstrap(channel,map.lastModification(),localIdentifier);
        LOG.info("String_Node_Str" + map.getIdentifier() + "String_Node_Str"+ bootstrap.identifier);
        socketChannelEntryReader.readAll(channel);
      }
      try {
        if (key.isWritable()) {
          final SocketChannel socketChannel=(SocketChannel)key.channel();
          final Attached attachment=(Attached)key.attachment();
          socketChannelEntryWriter.writeAll(socketChannel,attachment.remoteModificationIterator);
        }
        if (key.isReadable()) {
          final SocketChannel socketChannel=(SocketChannel)key.channel();
          final Attached attachment=(Attached)key.attachment();
          attachment.socketChannelEntryReader.readAll(socketChannel);
        }
      }
 catch (      Exception e) {
        LOG.error("String_Node_Str",e);
        try {
          key.channel().close();
        }
 catch (        IOException ex) {
        }
      }
      it.remove();
    }
  }
}