Program: 31451
Project: 31451
Buggy source:
@Override protected boolean runSerially(){
  int count=select(readFdSet.address,writeFdSet.address,0);
  if (count < 0) {
    LOG.error().$("String_Node_Str").$(Os.errno()).$();
    return false;
  }
  final long timestamp=System.currentTimeMillis();
  boolean useful=false;
  fds.clear();
  if (count > 0) {
    queryFdSets(timestamp);
    useful=true;
  }
  useful=processRegistrations(timestamp) | useful;
  int readFdCount=0;
  int writeFdCount=0;
  readFdSet.reset();
  writeFdSet.reset();
  long deadline=timestamp - timeout;
  for (int i=0, n=pending.size(); i < n; ) {
    long ts=pending.get(i,M_TIMESTAMP);
    long fd=pending.get(i,M_FD);
    int _new_op=fds.get(fd);
    if (_new_op == -1) {
      if (ts < deadline && fd != socketFd) {
        disconnect(pending.get(i),DisconnectReason.IDLE);
        pending.deleteRow(i);
        n--;
        useful=true;
        continue;
      }
      ChannelStatus op=ChannelStatus.values()[(int)pending.get(i,M_OPERATION)];
switch (op) {
case READ:
        readFdSet.add(fd);
      readFdCount++;
    i++;
  break;
case WRITE:
writeFdSet.add(fd);
writeFdCount++;
i++;
break;
case DISCONNECTED:
disconnect(pending.get(i),DisconnectReason.SILLY);
pending.deleteRow(i);
n--;
useful=true;
break;
case EOF:
disconnect(pending.get(i),DisconnectReason.PEER);
pending.deleteRow(i);
n--;
useful=true;
break;
default :
break;
}
}
 else {
final IOContext context=pending.get(i);
if ((_new_op & FD_READ) > 0) {
enqueue(context,ChannelStatus.READ);
}
if ((_new_op & FD_WRITE) > 0) {
enqueue(context,ChannelStatus.WRITE);
}
pending.deleteRow(i);
n--;
}
}
readFdSet.setCount(readFdCount);
writeFdSet.setCount(writeFdCount);
return useful;
}

Fixed version (ground truth):
@Override protected boolean runSerially(){
  int count=select(readFdSet.address,writeFdSet.address,0);
  if (count < 0) {
    LOG.error().$("String_Node_Str").$(Os.errno()).$();
    return false;
  }
  final long timestamp=System.currentTimeMillis();
  boolean useful=false;
  fds.clear();
  if (count > 0) {
    queryFdSets(timestamp);
    useful=true;
  }
  useful=processRegistrations(timestamp) | useful;
  int readFdCount=0;
  int writeFdCount=0;
  readFdSet.reset();
  writeFdSet.reset();
  long deadline=timestamp - timeout;
  for (int i=0, n=pending.size(); i < n; ) {
    long ts=pending.get(i,M_TIMESTAMP);
    long fd=pending.get(i,M_FD);
    int _new_op=fds.get(fd);
    if (_new_op == -1) {
      if (ts < deadline && fd != socketFd) {
        disconnect(pending.get(i),DisconnectReason.IDLE);
        pending.deleteRow(i);
        n--;
        useful=true;
        continue;
      }
      ChannelStatus op=ChannelStatus.values()[(int)pending.get(i,M_OPERATION)];
switch (op) {
case READ:
        readFdSet.add(fd);
      readFdCount++;
    i++;
  break;
case WRITE:
writeFdSet.add(fd);
writeFdCount++;
i++;
break;
case DISCONNECTED:
disconnect(pending.get(i),DisconnectReason.SILLY);
pending.deleteRow(i);
n--;
useful=true;
break;
case EOF:
disconnect(pending.get(i),DisconnectReason.PEER);
pending.deleteRow(i);
n--;
useful=true;
break;
default :
break;
}
}
 else {
final IOContext context=pending.get(i);
if ((_new_op & FD_READ) > 0 && Net.available(fd) == 0) {
disconnect(context,DisconnectReason.PEER);
}
 else {
if ((_new_op & FD_READ) > 0) {
enqueue(context,ChannelStatus.READ);
}
if ((_new_op & FD_WRITE) > 0) {
enqueue(context,ChannelStatus.WRITE);
}
}
pending.deleteRow(i);
n--;
}
}
readFdSet.setCount(readFdCount);
writeFdSet.setCount(writeFdCount);
return useful;
}