alibaba / jetcache

JetCache is a Java cache framework.
Apache License 2.0
5.08k stars 1.05k forks source link

jetcache(RedisLettuceCache) GET error #888

Closed Skqing closed 4 months ago

Skqing commented 4 months ago

版本 image

jetcache:
  statIntervalMinutes: 30
  areaInCacheName: false
  local:
    default:
      type: linkedhashmap
      keyConvertor: fastjson2
      limit: 500
  remote:
    default:
      type: redis.lettuce
      keyConvertor: fastjson2
      valueEncoder: java
      valueDecoder: java
      mode: cluster
      uri:
       - redis://172.18.0.80:6379
       - redis://172.18.0.81:6380
       - redis://172.18.0.82:6381

异常信息

2024-05-21 15:27:49.571 [lettuce-epollEventLoop-4-2] ERROR [com.alicp.jetcache.support.SquashedLogger.error: 71] - jetcache(RedisLettuceCache) GET error. key=[328924] 
2024-05-21 15:27:50.449 [lettuce-epollEventLoop-4-2] ERROR [com.alicp.jetcache.support.SquashedLogger.error: 71] - jetcache(RedisLettuceCache) GET error. key=[389557] 
2024-05-21 15:27:50.451 [lettuce-epollEventLoop-4-1] ERROR [com.alicp.jetcache.support.SquashedLogger.error: 71] - jetcache(RedisLettuceCache) GET error. key=[389557] 
2024-05-21 15:27:50.456 [lettuce-epollEventLoop-4-1] ERROR [com.alicp.jetcache.support.SquashedLogger.error: 71] - jetcache(RedisLettuceCache) GET error. key=[389557] 
2024-05-21 15:27:51.893 [lettuce-epollEventLoop-4-1] ERROR [com.alicp.jetcache.support.SquashedLogger.error: 71] - jetcache(RedisLettuceCache) GET error. key=[443898] 
2024-05-21 15:27:52.788 [lettuce-epollEventLoop-4-1] ERROR [com.alicp.jetcache.support.SquashedLogger.error: 71] - jetcache(RedisLettuceCache) GET error. key=[389557] 
2024-05-21 15:27:53.107 [lettuce-epollEventLoop-4-1] ERROR [com.alicp.jetcache.support.SquashedLogger.error: 71] - jetcache(RedisLettuceCache) GET error. key=[443898] 
2024-05-21 15:27:53.116 [lettuce-epollEventLoop-4-1] ERROR [com.alicp.jetcache.support.SquashedLogger.error: 71] - jetcache(RedisLettuceCache) GET error. key=[443898] 
2024-05-21 15:27:53.838 [lettuce-epollEventLoop-4-1] ERROR [com.alicp.jetcache.support.SquashedLogger.error: 71] - jetcache(RedisLettuceCache) GET error. key=[389557] 
2024-05-21 15:27:53.845 [lettuce-epollEventLoop-4-1] ERROR [com.alicp.jetcache.support.SquashedLogger.error: 71] - jetcache(RedisLettuceCache) GET error. key=[389557] 
2024-05-21 15:27:53.847 [lettuce-epollEventLoop-4-1] ERROR [com.alicp.jetcache.support.SquashedLogger.error: 71] - jetcache(RedisLettuceCache) GET error. key=[389557] 
2024-05-21 15:27:54.098 [lettuce-epollEventLoop-4-1] ERROR [com.alicp.jetcache.support.SquashedLogger.error: 71] - jetcache(RedisLettuceCache) GET error. key=[747572] 
2024-05-21 15:27:54.711 [lettuce-epollEventLoop-4-2] ERROR [com.alicp.jetcache.support.SquashedLogger.error: 71] - jetcache(RedisLettuceCache) GET error. key=[97791069] 
2024-05-21 15:27:54.713 [lettuce-epollEventLoop-4-1] ERROR [com.alicp.jetcache.support.SquashedLogger.error: 71] - jetcache(RedisLettuceCache) GET error. key=[97791069] 
2024-05-21 15:27:56.564 [lettuce-epollEventLoop-4-2] ERROR [com.alicp.jetcache.support.SquashedLogger.error: 54] - jetcache(RedisLettuceCache) GET error. key=[373673]

根据配置,使用的序列化方式是Java,为什么还报GET错误呢? 并且最近一直使用的是这个版本,没有升级,已经不知道什么原因突然就发现报这样的异常了(多服务环境,一个缓存会被多个服务实例化)

参考: https://github.com/alibaba/jetcache/issues/690 https://github.com/alibaba/jetcache/issues/886

areyouok commented 4 months ago

每10秒应该会输出一次异常栈信息,如果你找不到,那就只能用这个commit看看了,先自己打snapshot包。

java原生序列化也不是万能的,一个很常见的错误就是某个要序列化的类没有加serialVersionUID,然后又增删了字段,反序列化的时候就会报错。

Skqing commented 4 months ago

有些是集合框架,或者封装类型也会报错,比较纳闷

private Cache<String, Map<Integer, Set<Integer>>> shopRelationshipCache;
private Cache<String, String>
private Cache<Integer, Integer>

看来还是按照您说的打snapshot包,把完整日志打印出来才行

L-Y-CHENG commented 3 months ago

有些是集合框架,或者封装类型也会报错,比较纳闷

private Cache<String, Map<Integer, Set<Integer>>> shopRelationshipCache;
private Cache<String, String>
private Cache<Integer, Integer>

看来还是按照您说的打snapshot包,把完整日志打印出来才行

请问你的问题通过查看日志解决了嘛? 我这里也是遇到这个问题,
我也是多个服务使用这个缓存框架, 一直好好的突然有个服务获取不到缓存了. 其他服务节点请求没有任何问题 我用的也是 redis.lettuce, 序列化是配置的Java序列化. 找不出原因. 想请教下你解决了嘛