Program: 153256
Project: 153256
Buggy source:
public void run(){
  ByteCircleBuffer bcb=new ByteCircleBuffer(20);
  boolean eof=false;
  byte[] buffer=new byte[131072];
  resetCounters();
  long startTime=System.currentTimeMillis();
  long lastTime=startTime;
  period=Globals.monitorBandwidth();
  boolean monitor=period > 0;
  while (!eof && !super.killed()) {
    long currentTime=System.currentTimeMillis();
    if (monitor && currentTime > lastTime + period) {
      lastTime=currentTime;
      printBandwidth(ptc,currentTime - startTime);
    }
    Byte packetId=UnitByte.getByte(in,ptc,this);
    if (packetId == null) {
      if (!Globals.isQuiet()) {
        ptc.printLogMessage("String_Node_Str");
      }
      eof=true;
      continue;
    }
    if (packetId == (byte)0xFF) {
      PacketFFKick kickPacket=new PacketFFKick((byte)0xFF);
      if (Globals.isVerbose()) {
        ptc.printLogMessage("String_Node_Str" + packetId);
      }
      if (kickPacket.read(in,ptc,this,true,linkState) == null) {
        if (!Globals.isQuiet()) {
          ptc.printLogMessage("String_Node_Str");
        }
        eof=true;
        continue;
      }
      String reason=kickPacket.getMessage();
      String redirect=PacketFFKick.redirectDetected(reason,ptc);
      if (redirect != null) {
        ptc.printLogMessage("String_Node_Str" + redirect);
        ptc.setRedirect(redirect);
        Packet46ServerState serverState=new Packet46ServerState(out,ptc,this);
        serverState.setState((byte)2);
        if (serverState.packetId == null || serverState.write(out,ptc,this,true) == null) {
          ptc.printLogMessage("String_Node_Str");
          ptc.setRedirect(null);
          eof=true;
          continue;
        }
        if (!destroyEntities()) {
          ptc.printLogMessage("String_Node_Str");
          ptc.setRedirect(null);
          eof=true;
          continue;
        }
 else {
          if (!Globals.isQuiet()) {
            ptc.printLogMessage("String_Node_Str");
          }
        }
        if (!unloadChunks()) {
          ptc.printLogMessage("String_Node_Str");
          ptc.setRedirect(null);
          eof=true;
          continue;
        }
 else {
          if (!Globals.isQuiet()) {
            ptc.printLogMessage("String_Node_Str");
          }
        }
        eof=true;
        continue;
      }
 else {
        UnitByte.writeByte(out,packetId,ptc,this);
        kickPacket.write(out,ptc,this,true);
      }
    }
 else {
      if (UnitByte.writeByte(out,packetId,ptc,this) == null) {
        if (!Globals.isQuiet()) {
          ptc.printLogMessage("String_Node_Str");
        }
        eof=true;
        continue;
      }
      Packet currentPacket=new Packet(packetId);
      bcb.write(packetId);
      if (currentPacket.critical) {
        ptc.printLogMessage("String_Node_Str" + bcb);
      }
      if (Globals.isVerbose()) {
        ptc.printLogMessage("String_Node_Str" + Integer.toHexString(packetId & 0xFF));
      }
      if (currentPacket.packetId == null || currentPacket.pass(in,out,ptc,this,true,buffer,linkState) == null) {
        if (!Globals.isQuiet()) {
          ptc.printLogMessage("String_Node_Str");
        }
        eof=true;
        continue;
      }
    }
  }
  ptc.interrupt();
}

Fixed version (ground truth):
public void run(){
  ByteCircleBuffer bcb=new ByteCircleBuffer(20);
  boolean eof=false;
  byte[] buffer=new byte[163840];
  resetCounters();
  long startTime=System.currentTimeMillis();
  long lastTime=startTime;
  period=Globals.monitorBandwidth();
  boolean monitor=period > 0;
  while (!eof && !super.killed()) {
    long currentTime=System.currentTimeMillis();
    if (monitor && currentTime > lastTime + period) {
      lastTime=currentTime;
      printBandwidth(ptc,currentTime - startTime);
    }
    Byte packetId=UnitByte.getByte(in,ptc,this);
    if (packetId == null) {
      if (!Globals.isQuiet()) {
        ptc.printLogMessage("String_Node_Str");
      }
      eof=true;
      continue;
    }
    if (packetId == (byte)0xFF) {
      PacketFFKick kickPacket=new PacketFFKick((byte)0xFF);
      if (Globals.isVerbose()) {
        ptc.printLogMessage("String_Node_Str" + packetId);
      }
      if (kickPacket.read(in,ptc,this,true,linkState) == null) {
        if (!Globals.isQuiet()) {
          ptc.printLogMessage("String_Node_Str");
        }
        eof=true;
        continue;
      }
      String reason=kickPacket.getMessage();
      String redirect=PacketFFKick.redirectDetected(reason,ptc);
      if (redirect != null) {
        ptc.printLogMessage("String_Node_Str" + redirect);
        ptc.setRedirect(redirect);
        Packet46ServerState serverState=new Packet46ServerState(out,ptc,this);
        serverState.setState((byte)2);
        if (serverState.packetId == null || serverState.write(out,ptc,this,true) == null) {
          ptc.printLogMessage("String_Node_Str");
          ptc.setRedirect(null);
          eof=true;
          continue;
        }
        if (!destroyEntities()) {
          ptc.printLogMessage("String_Node_Str");
          ptc.setRedirect(null);
          eof=true;
          continue;
        }
 else {
          if (!Globals.isQuiet()) {
            ptc.printLogMessage("String_Node_Str");
          }
        }
        if (!unloadChunks()) {
          ptc.printLogMessage("String_Node_Str");
          ptc.setRedirect(null);
          eof=true;
          continue;
        }
 else {
          if (!Globals.isQuiet()) {
            ptc.printLogMessage("String_Node_Str");
          }
        }
        eof=true;
        continue;
      }
 else {
        UnitByte.writeByte(out,packetId,ptc,this);
        kickPacket.write(out,ptc,this,true);
      }
    }
 else {
      if (UnitByte.writeByte(out,packetId,ptc,this) == null) {
        if (!Globals.isQuiet()) {
          ptc.printLogMessage("String_Node_Str");
        }
        eof=true;
        continue;
      }
      Packet currentPacket=new Packet(packetId);
      bcb.write(packetId);
      if (currentPacket.critical) {
        ptc.printLogMessage("String_Node_Str" + bcb);
      }
      if (Globals.isVerbose()) {
        ptc.printLogMessage("String_Node_Str" + Integer.toHexString(packetId & 0xFF));
      }
      if (currentPacket.packetId == null || currentPacket.pass(in,out,ptc,this,true,buffer,linkState) == null) {
        if (!Globals.isQuiet()) {
          ptc.printLogMessage("String_Node_Str");
        }
        eof=true;
        continue;
      }
    }
  }
  ptc.interrupt();
}