1、Protocol message contained an invalid tag (zero) ,剧安颌儿如下图所示,这个错误产生的原因是在解释协议数据时,数据中包含了无效的数据,基本上就是数据在传输的过程中被修改了
2、一种情况就是在网络上传输的过程中,数据可能被丢失,或者编码和解码不对等造成数据不一致,这种情况的排查就要检查对比数据了
3、另一种情况就是程序的逻辑代码有bug,比如多个帧霭绎郎线程同时对一块内存进行写操作,造成数据不一致,这种情况造成的机率比较大,这种的排查就要检查逻辑代码的实现,对比数据是否一致了
4、还有一种情况是你的proto协议文件版本不一致,即数据源的打包和解包两端的协议版本不一致,可以检查一下协议的版本
5、由于数据错乱还会抱出其它奇怪的异常,如Protobuf error:Protocol message tag had invalid wire type
6、再比如,还有这种异常:Protocol message end-group tag did not match expected tag
7、还有下面这种异常:诔罨租磊InvalidProtocolBufferException: While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either that the input has been truncated or that an embedded message misreported its own length