一、该问题的重现步骤是什么?
bladeRedis.hIncrBy(key, hashKey, 2); // 第一次redis值为正常2
Integer value = redis.hGet(key, hashKey); // 取值报错,反序列化异常
// 堆栈信息如下:
java.lang.RuntimeException: Truncated.
at io.protostuff.IOUtil.mergeFrom(IOUtil.java:50)
at io.protostuff.ProtostuffIOUtil.mergeFrom(ProtostuffIOUtil.java:104)
at org.springblade.core.redis.serializer.ProtoStuffSerializer.deserialize(ProtoStuffSerializer.java:59)
at org.springframework.data.redis.core.AbstractOperations.deserializeHashValue(AbstractOperations.java:355)
at org.springframework.data.redis.core.DefaultHashOperations.get(DefaultHashOperations.java:55)
Caused by: io.protostuff.ProtobufException: While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either than the input has been truncated or that an embedded message misreported its own length.
at io.protostuff.ProtobufException.truncatedMessage(ProtobufException.java:76)
... 123 common frames omitted
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at io.protostuff.ByteArrayInput.readRawVarint32(ByteArrayInput.java:531)
at io.protostuff.ByteArrayInput.skipField(ByteArrayInput.java:179)
at io.protostuff.ByteArrayInput.handleUnknownField(ByteArrayInput.java:217)
at io.protostuff.runtime.RuntimeSchema.mergeFrom(RuntimeSchema.java:462)
at io.protostuff.IOUtil.mergeFrom(IOUtil.java:45)
... 122 common frames omitted
二、你期待的结果是什么?实际看到的又是什么?
期待 value 返回 2,实际报错
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
BladeX
四、请提供详细的错误堆栈信息,这很重要。
java.lang.RuntimeException: Truncated.
at io.protostuff.IOUtil.mergeFrom(IOUtil.java:50)
at io.protostuff.ProtostuffIOUtil.mergeFrom(ProtostuffIOUtil.java:104)
at org.springblade.core.redis.serializer.ProtoStuffSerializer.deserialize(ProtoStuffSerializer.java:59)
at org.springframework.data.redis.core.AbstractOperations.deserializeHashValue(AbstractOperations.java:355)
at org.springframework.data.redis.core.DefaultHashOperations.get(DefaultHashOperations.java:55)
Caused by: io.protostuff.ProtobufException: While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either than the input has been truncated or that an embedded message misreported its own length.
at io.protostuff.ProtobufException.truncatedMessage(ProtobufException.java:76)
... 123 common frames omitted
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at io.protostuff.ByteArrayInput.readRawVarint32(ByteArrayInput.java:531)
at io.protostuff.ByteArrayInput.skipField(ByteArrayInput.java:179)
at io.protostuff.ByteArrayInput.handleUnknownField(ByteArrayInput.java:217)
at io.protostuff.runtime.RuntimeSchema.mergeFrom(RuntimeSchema.java:462)
at io.protostuff.IOUtil.mergeFrom(IOUtil.java:45)
... 122 common frames omitted
五、若有更多详细信息,请在下面提供。
不止是 hIncrBy() 之后 hGet() 会报错,其他类型 incrBy() 都会报错
将序列化方式改为JDK序列化,同样报错,仅堆栈信息不一致
blade.redis.serializer-type=JDK
扫一扫访问 Blade技术社区 移动端