Program: 91312
Project: 91312
Buggy source:
private void process(@NotNull final ReplicatedSharedHashMap map,final int serializedEntrySize,@NotNull final EntryExternalizable externalizable,@NotNull final TcpReplicatorBuilder tcpReplicatorBuilder) throws IOException {
  final byte identifier=map.identifier();
  final short packetSize=tcpReplicatorBuilder.packetSize();
  try {
    final Queue<SelectableChannel> pendingRegistrations=connector.asyncConnect(identifier,tcpReplicatorBuilder.endpoints(),tcpReplicatorBuilder.serverInetSocketAddress());
    for (; ; ) {
      register(pendingRegistrations);
      if (!selector.isOpen())       return;
      final int nSelectedKeys=selector.select(100);
      if (nSelectedKeys == 0) {
        continue;
      }
      final long approxTime=System.currentTimeMillis();
      final long heartBeatInterval=tcpReplicatorBuilder.heartBeatInterval();
      final long approxTimeOutTime=approxTime - (long)(heartBeatInterval * 1.10);
      final Set<SelectionKey> selectedKeys=selector.selectedKeys();
      for (      final SelectionKey key : selectedKeys) {
        try {
          if (!key.isValid())           continue;
          if (key.isAcceptable())           doAccept(key,serializedEntrySize,externalizable,packetSize,map.identifier(),heartBeatInterval);
          if (key.isConnectable())           onConnect(packetSize,serializedEntrySize,externalizable,key,map.identifier(),pendingRegistrations,heartBeatInterval);
          if (key.isReadable())           onRead(map,key,approxTime);
          if (key.isWritable())           onWrite(key,approxTime);
          checkHeartbeat(key,approxTimeOutTime,identifier,pendingRegistrations);
        }
 catch (        CancelledKeyException e) {
          quietClose(key,e);
        }
catch (        ClosedSelectorException e) {
          quietClose(key,e);
        }
catch (        ClosedChannelException e) {
          quietClose(key,e);
        }
catch (        ConnectException e) {
          quietClose(key,e);
        }
catch (        Exception e) {
          LOG.info("String_Node_Str",e);
          close(key);
        }
      }
      selectedKeys.clear();
    }
  }
 catch (  ClosedSelectorException e) {
    if (LOG.isDebugEnabled())     LOG.debug("String_Node_Str",e);
  }
catch (  ClosedChannelException e) {
    if (LOG.isDebugEnabled())     LOG.debug("String_Node_Str",e);
  }
catch (  ConnectException e) {
    if (LOG.isDebugEnabled())     LOG.debug("String_Node_Str",e);
  }
catch (  Exception e) {
    LOG.error("String_Node_Str",e);
  }
 finally {
    if (selector != null)     try {
      selector.close();
    }
 catch (    IOException e) {
      if (LOG.isDebugEnabled())       LOG.debug("String_Node_Str",e);
    }
    close();
  }
}

Fixed version (ground truth):
private void process(@NotNull final ReplicatedSharedHashMap map,final int serializedEntrySize,@NotNull final EntryExternalizable externalizable,@NotNull final TcpReplicatorBuilder tcpReplicatorBuilder) throws IOException {
  final byte identifier=map.identifier();
  final short packetSize=tcpReplicatorBuilder.packetSize();
  try {
    pendingRegistrations=connector.asyncConnect(identifier,tcpReplicatorBuilder.endpoints(),tcpReplicatorBuilder.serverInetSocketAddress());
    for (; ; ) {
      register(pendingRegistrations);
      if (!selector.isOpen())       return;
      final int nSelectedKeys=selector.select(100);
      if (nSelectedKeys == 0) {
        continue;
      }
      final long approxTime=System.currentTimeMillis();
      final long heartBeatInterval=tcpReplicatorBuilder.heartBeatInterval();
      final long approxTimeOutTime=approxTime - (long)(heartBeatInterval * 1.10);
      final Set<SelectionKey> selectedKeys=selector.selectedKeys();
      for (      final SelectionKey key : selectedKeys) {
        try {
          if (!key.isValid())           continue;
          if (key.isAcceptable())           onAccept(key,serializedEntrySize,externalizable,packetSize,map.identifier(),heartBeatInterval);
          if (key.isConnectable())           onConnect(packetSize,serializedEntrySize,externalizable,key,map.identifier(),pendingRegistrations,heartBeatInterval);
          if (key.isReadable())           onRead(map,key,approxTime);
          if (key.isWritable())           onWrite(key,approxTime);
          checkHeartbeat(key,approxTimeOutTime,identifier,pendingRegistrations);
        }
 catch (        CancelledKeyException e) {
          quietClose(key,e);
        }
catch (        ClosedSelectorException e) {
          quietClose(key,e);
        }
catch (        IOException e) {
          quietClose(key,e);
        }
catch (        Exception e) {
          LOG.info("String_Node_Str",e);
          close(key);
        }
      }
      selectedKeys.clear();
    }
  }
 catch (  ClosedSelectorException e) {
    if (LOG.isDebugEnabled())     LOG.debug("String_Node_Str",e);
  }
catch (  ClosedChannelException e) {
    if (LOG.isDebugEnabled())     LOG.debug("String_Node_Str",e);
  }
catch (  ConnectException e) {
    if (LOG.isDebugEnabled())     LOG.debug("String_Node_Str",e);
  }
catch (  Exception e) {
    LOG.error("String_Node_Str",e);
  }
 finally {
    if (selector != null)     try {
      selector.close();
    }
 catch (    IOException e) {
      if (LOG.isDebugEnabled())       LOG.debug("String_Node_Str",e);
    }
    close();
  }
}