TM连接redis-cluster报错
- 主要言語
- Java
- スター
- 4.2k
- フォーク
- 1.4k
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
- [ ] I have searched the [issues](https://github.com/codingapi/tx-lcn/issues) of this repository and believe that this is not a duplicate.
### 1. Bug Description
TM连接redis-cluster报错
### 2. Environment:
- JDK version: JDK8
- OS: centosOS 6.7
- TX-LCN version: 5.0.2
- Others:
**redis版本 5.0.3**
**redis-cluster配置:**
spring.redis.lettuce.pool.max-active=70
spring.redis.lettuce.pool.min-idle=10
spring.redis.lettuce.pool.max-idle=10
spring.redis.cluster.nodes=192.168.124.203:9001,192.168.124.203:9002,192.168.124.203:9003,192.168.124.203:9004,192.168.124.203:9005,192.168.124.203:9006
spring.redis.cluster.max-redirects=6
spring.redis.password=654310
spring.redis.timeout=60000ms
异常信息:
org.springframework.data.redis.RedisSystemException: Unknown redis exception;
nested exception is java.lang.ClassCastException:
**com.sun.proxy.$Proxy163 cannot be cast to io.lettuce.core.api.sync.RedisCommands**
at org.springframework.data.redis.FallbackExceptionTranslationStrategy.getFallback(FallbackExceptionTranslationStrategy.java:53)
at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:43)
at org.springframework.data.redis.connection.lettuce.LettuceConnection.convertLettuceAccessException(LettuceConnection.java:268)
at org.springframework.data.redis.connection.lettuce.LettuceConnection.discard(LettuceConnection.java:623)
at org.springframework.data.redis.connection.DefaultStringRedisConnection.discard(DefaultStringRedisConnection.java:273)
at org.springframework.data.redis.core.RedisTemplate.lambda$discard$22(RedisTemplate.java:1019)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:224)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:184)
at org.springframework.data.redis.core.RedisTemplate.discard(RedisTemplate.java:1018)
at com.codingapi.txlcn.tm.core.storage.redis.RedisStorage.refreshMachines(RedisStorage.java:269)
at com.codingapi.txlcn.tm.support.service.impl.ManagerServiceImpl.refreshMachines(ManagerServiceImpl.java:86)
at com.codingapi.txlcn.tm.txmsg.EnsureIdGenEngine.onTmReceivedHeart(EnsureIdGenEngine.java:61)
at com.codingapi.txlcn.txmsg.netty.handler.RpcCmdDecoder.channelRead0(RpcCmdDecoder.java:61)
at com.codingapi.txlcn.txmsg.netty.handler.RpcCmdDecoder.channelRead0(RpcCmdDecoder.java:40)
**这段代码报错了**
public void refreshMachines(long timeout, long... machines) {
try {
**stringRedisTemplate.setEnableTransactionSupport(true);
stringRedisTemplate.multi();**
for (long mac : machines) {
stringRedisTemplate.opsForValue().set(REDIS_MACHINE_ID_MAP_PREFIX + mac, "", timeout, TimeUnit.MILLISECONDS);
}
stringRedisTemplate.exec();
} catch (Throwable e) {
stringRedisTemplate.discard();
} finally {
stringRedisTemplate.setEnableTransactionSupport(false);
}
}
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
com.codingapi.txlcn.tm.core.storage.redis.RedisStorage.refreshMachinesから調査を開始し、特にトランザクション呼び出しとスタックトレースに示されているdiscardパスを確認します。提供されたRedis 5.0.3クラスタ構成で障害を再現し、Spring Data RedisとLettuceの相互作用を調査します。TMがRedisSystemExceptionやClassCastExceptionを発生させずにマシンを更新できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java, redis, spring
- 領域
- backend, databases
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100