Program: 12472
Project: 12472
Buggy source:
/** 
 * 读取新消息 LengthFieldBasedFrameDecoder 自动解包
 */
@Override public void channelRead(ChannelHandlerContext ctx,Object msg){
  logger.info("String_Node_Str" + ctx.channel().hashCode());
  MetricBuilder.requestMeter.mark();
  final PBAPNSEvent cc;
  try {
    byte[] bytes=(byte[])msg;
    logger.info("String_Node_Str",bytes.length);
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str",bytes);
    }
    cc=PBAPNSEvent.newBuilder().mergeFrom(bytes).build();
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    ack(ctx,null);
    return;
  }
  ReferenceCountUtil.release(msg);
  if (cc.getTypeId() == PBAPNSEvent.DeviceTypes.Android_VALUE) {
    MetricBuilder.clientAndroidMeter.mark();
  }
 else   if (cc.getTypeId() == PBAPNSEvent.DeviceTypes.iOS_VALUE) {
    MetricBuilder.clientIOSMeter.mark();
  }
  if (cc.getOp() == PBAPNSEvent.Ops.Online_VALUE) {
    ConnectionKeeper.add(cc.getAppKey(),cc.getUserId(),new Connection(ctx.channel()));
    MessageHandlerPoolTasks.instance.getExecutor().submit(new OnNewlyAddThread(cc));
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.KeepAlive_VALUE) {
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.PushAck_VALUE) {
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.Offline_VALUE) {
    MessageHandlerPoolTasks.instance.getExecutor().submit(new Runnable(){
      @Override public void run(){
        Client c0=ClientService.instance.findByUserId(cc.getUserId());
        if (c0 != null) {
          ClientService.instance.updateOnlineTs(c0.getId());
        }
      }
    }
);
    ctx.close();
  }
}

Fixed version (ground truth):
/** 
 * 读取新消息 LengthFieldBasedFrameDecoder 自动解包
 */
@Override public void channelRead(ChannelHandlerContext ctx,Object msg){
  if (logger.isDebugEnabled()) {
    logger.info("String_Node_Str" + ctx.channel().hashCode());
  }
  MetricBuilder.requestMeter.mark();
  final PBAPNSEvent cc;
  try {
    byte[] bytes=(byte[])msg;
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str",bytes.length);
      logger.debug("String_Node_Str",bytes);
    }
    cc=PBAPNSEvent.newBuilder().mergeFrom(bytes).build();
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    ack(ctx,null);
    return;
  }
  ReferenceCountUtil.release(msg);
  if (cc.getTypeId() == PBAPNSEvent.DeviceTypes.Android_VALUE) {
    MetricBuilder.clientAndroidMeter.mark();
  }
 else   if (cc.getTypeId() == PBAPNSEvent.DeviceTypes.iOS_VALUE) {
    MetricBuilder.clientIOSMeter.mark();
  }
  if (cc.getOp() == PBAPNSEvent.Ops.Online_VALUE) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str",cc);
    }
    ConnectionKeeper.add(cc.getAppKey(),cc.getUserId(),new Connection(ctx.channel()));
    MessageHandlerPoolTasks.instance.getExecutor().submit(new OnNewlyAddThread(cc));
    ack(ctx,cc);
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str",cc);
    }
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.KeepAlive_VALUE) {
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.PushAck_VALUE) {
    ack(ctx,cc);
  }
 else   if (cc.getOp() == PBAPNSEvent.Ops.Offline_VALUE) {
    MessageHandlerPoolTasks.instance.getExecutor().submit(new Runnable(){
      @Override public void run(){
        Client c0=ClientService.instance.findByUserId(cc.getUserId());
        if (c0 != null) {
          ClientService.instance.updateOnlineTs(c0.getId());
        }
      }
    }
);
    ctx.close();
  }
}