Program: 41796
Project: 41796
Buggy source:
@Override public void run(){
  try {
    long index=readIndex(socket);
    ExcerptTailer excerpt=chronicle.createTailer();
    ByteBuffer bb=TcpUtil.createBuffer(1,ByteOrder.nativeOrder());
    long sendInSync=0;
    boolean first=true;
    OUTER:     while (!closed) {
      while (!excerpt.nextIndex()) {
        long now=System.currentTimeMillis();
        if (excerpt.wasPadding()) {
          if (index >= 0) {
            bb.clear();
            if (first) {
              bb.putLong(excerpt.index());
              first=false;
            }
            bb.putInt(PADDED_LEN);
            bb.flip();
            TcpUtil.writeAll(socket,bb);
            sendInSync=now + HEARTBEAT_INTERVAL_MS;
          }
          index++;
          continue;
        }
        if (sendInSync <= now && !first) {
          bb.clear();
          bb.putInt(IN_SYNC_LEN);
          bb.flip();
          TcpUtil.writeAll(socket,bb);
          sendInSync=now + HEARTBEAT_INTERVAL_MS;
        }
        pause();
        if (closed)         break OUTER;
      }
      pauseReset();
      final long size=excerpt.capacity();
      long remaining;
      bb.clear();
      if (first) {
        bb.putLong(excerpt.index());
        first=false;
        remaining=size + TcpUtil.HEADER_SIZE;
      }
 else {
        remaining=size + 4;
      }
      bb.putInt((int)size);
      if (size > bb.capacity() / 2) {
        while (remaining > 0) {
          int size2=(int)Math.min(remaining,bb.capacity());
          bb.limit(size2);
          excerpt.read(bb);
          bb.flip();
          remaining-=bb.remaining();
          TcpUtil.writeAll(socket,bb);
        }
      }
 else {
        bb.limit((int)remaining);
        excerpt.read(bb);
        int count=1;
        while (count++ < MAX_MESSAGE) {
          if (excerpt.nextIndex()) {
            if (excerpt.wasPadding()) {
              index++;
              continue;
            }
            if (excerpt.remaining() + 4 >= bb.capacity() - bb.position())             break;
            int size2=(int)excerpt.capacity();
            bb.limit(bb.position() + size2 + 4);
            bb.putInt(size2);
            excerpt.read(bb);
            index++;
          }
        }
        bb.flip();
        TcpUtil.writeAll(socket,bb);
      }
      if (bb.remaining() > 0)       throw new EOFException("String_Node_Str" + index);
      index++;
      sendInSync=0;
    }
  }
 catch (  Exception e) {
    if (!closed) {
      String msg=e.getMessage();
      if (msg != null && (msg.contains("String_Node_Str") || msg.contains("String_Node_Str") || msg.contains("String_Node_Str")))       logger.log(Level.INFO,"String_Node_Str" + socket + "String_Node_Str"+ e);
 else       logger.log(Level.INFO,"String_Node_Str" + socket + "String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    long index=readIndex(socket);
    ExcerptTailer excerpt=chronicle.createTailer();
    ByteBuffer bb=TcpUtil.createBuffer(1,ByteOrder.nativeOrder());
    long sendInSync=0;
    boolean first=true;
    OUTER:     while (!closed) {
      while (!excerpt.nextIndex()) {
        long now=System.currentTimeMillis();
        if (excerpt.wasPadding()) {
          if (index >= 0) {
            bb.clear();
            if (first) {
              bb.putLong(excerpt.index());
              first=false;
            }
            bb.putInt(PADDED_LEN);
            bb.flip();
            TcpUtil.writeAll(socket,bb);
            sendInSync=now + HEARTBEAT_INTERVAL_MS;
          }
          index++;
          continue;
        }
        pause();
        if (closed)         break OUTER;
      }
      pauseReset();
      final long size=excerpt.capacity();
      long remaining;
      bb.clear();
      if (first) {
        bb.putLong(excerpt.index());
        first=false;
        remaining=size + TcpUtil.HEADER_SIZE;
      }
 else {
        remaining=size + 4;
      }
      bb.putInt((int)size);
      if (size > bb.capacity() / 2) {
        while (remaining > 0) {
          int size2=(int)Math.min(remaining,bb.capacity());
          bb.limit(size2);
          excerpt.read(bb);
          bb.flip();
          remaining-=bb.remaining();
          TcpUtil.writeAll(socket,bb);
        }
      }
 else {
        bb.limit((int)remaining);
        excerpt.read(bb);
        int count=1;
        while (count++ < MAX_MESSAGE) {
          if (excerpt.nextIndex()) {
            if (excerpt.wasPadding()) {
              index++;
              continue;
            }
            if (excerpt.remaining() + 4 >= bb.capacity() - bb.position())             break;
            int size2=(int)excerpt.capacity();
            bb.limit(bb.position() + size2 + 4);
            bb.putInt(size2);
            excerpt.read(bb);
            index++;
          }
        }
        bb.flip();
        TcpUtil.writeAll(socket,bb);
      }
      if (bb.remaining() > 0)       throw new EOFException("String_Node_Str" + index);
      index++;
      sendInSync=0;
    }
  }
 catch (  Exception e) {
    if (!closed) {
      String msg=e.getMessage();
      if (msg != null && (msg.contains("String_Node_Str") || msg.contains("String_Node_Str") || msg.contains("String_Node_Str")))       logger.log(Level.INFO,"String_Node_Str" + socket + "String_Node_Str"+ e);
 else       logger.log(Level.INFO,"String_Node_Str" + socket + "String_Node_Str",e);
    }
  }
}