Program: 91389
Project: 91389
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(entrySize,this.externalizable);
        final WelcomeMessage welcomeMessage=socketChannelEntryReader.readWelcomeMessage(channel);
        final ModificationIterator remoteModificationIterator=map.acquireModificationIterator(welcomeMessage.identifier);
        remoteModificationIterator.dirtyEntries(welcomeMessage.timeStamp);
        final Attached attached=new Attached(socketChannelEntryReader,remoteModificationIterator);
        channel.register(selector,SelectionKey.OP_WRITE | SelectionKey.OP_READ,attached);
        socketChannelEntryWriter.sendWelcomeMessage(channel,map.lastModification(),localIdentifier);
      }
      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) {
        if (!isClosed.get()) {
          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(entrySize,this.externalizable);
        final WelcomeMessage welcomeMessage=socketChannelEntryReader.readWelcomeMessage(channel);
        final ModificationIterator remoteModificationIterator=map.acquireModificationIterator(welcomeMessage.identifier);
        remoteModificationIterator.dirtyEntries(welcomeMessage.timeStamp);
        final Attached attached=new Attached(socketChannelEntryReader,remoteModificationIterator);
        channel.register(selector,SelectionKey.OP_WRITE | SelectionKey.OP_READ,attached);
        socketChannelEntryWriter.sendWelcomeMessage(channel,map.lastModification(),localIdentifier);
      }
      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.log(Level.SEVERE,"String_Node_Str",e);
        try {
          key.channel().close();
        }
 catch (        IOException ex) {
        }
      }
      it.remove();
    }
  }
}