Redisson碰到的問題

 

最近開發環境使用redisson(版本是2.8.0),在部署一段時間(半個小時左右),獲取分佈式鎖會報超時異常(org.redisson.client.RedisTimeoutException: Redis server response timeout (3000 ms) occured for command):java

2018-06-28 15:01:55.919 [http-nio-8081-exec-6] ERROR [com.skylink.fincredit.controller.JoinThirdController.getLock(JoinThirdController.java:169)] exception ..... org.redisson.client.RedisTimeoutException: Redis server response timeout (3000 ms) occured for command: (EVAL) with params: [if (redis.call('exists', KEYS[1]) == 0) then redis.call('hset', KEYS[1], ARGV[2], 1); redis.call('pe..., 1, sl.redis.locker.finance_acc_customer11000018_3333333333, 60000, 5b4c46fd-d283-49f0-bf98-d7f160df863e:37] channel: [id: 0xf02a572d, L:/192.168.15.126:54288 - R:/192.168.20.66:7301]
    at org.redisson.command.CommandAsyncService$11.run(CommandAsyncService.java:704) ~[redisson-3.6.5.jar:?] at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:663) ~[netty-common-4.1.22.Final.jar:4.1.22.Final] at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:738) ~[netty-common-4.1.22.Final.jar:4.1.22.Final] at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:466) ~[netty-common-4.1.22.Final.jar:4.1.22.Final] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66] 2018-06-28 15:01:58 ERROR [com.skylink.common.locker.redisson.RedissonLocker.release(RedissonLocker.java:72)] Locker release(finance_acc_customer11000018_3333333333) throw Exception. org.redisson.client.RedisTimeoutException: Redis server response timeout (3000 ms) occured for command: (EVAL) with params: [if (redis.call('exists', KEYS[1]) == 0) then redis.call('publish', KEYS[2], ARGV[1]); return 1; end;..., 2, sl.redis.locker.finance_acc_customer11000018_3333333333, redisson_lock__channel:{sl.redis.locker.finance_acc_customer11000018_3333333333}, 0, 30000, 5b4c46fd-d283-49f0-bf98-d7f160df863e:37] channel: [id: 0x34dfe77f, L:/192.168.15.126:54281 - R:/192.168.20.66:7301] at org.redisson.command.CommandAsyncService$11.run(CommandAsyncService.java:704) at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:663) at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:738) at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:466) at java.lang.Thread.run(Thread.java:745) 2018-06-28 15:01:59.004 [http-nio-8081-exec-6] INFO [com.skylink.fincredit.logger.LoggingAspect.logAround(LoggingAspect.java:85)] Exit: com.skylink.fincredit.controller.JoinThirdController.getLock() with result = {retCode=SUCCESS, retMsg=操做成功 } 2018-06-28 15:02:14.098 [redisson-netty-1-8] ERROR [org.redisson.client.handler.CommandsQueue.exceptionCaught(CommandsQueue.java:139)] Exception occured. Channel: [id: 0xf02a572d, L:/192.168.15.126:54288 - R:/192.168.20.66:7301] java.io.IOException: 遠程主機強迫關閉了一個現有的鏈接。

查看資料,該問題在2017年11月23號已經修復(參見:https://github.com/redisson/redisson/issues/946),更新ressdion到3.6.5,設置setPingConnectionInterval爲60秒:git

測試後問題仍是沒有解決,繼續在GitHub上查看原代碼,發如今3.6.5版本沒有修改徹底,存在bug,查看在18年4月27號修復了:github

 

 

 繼續升級版本到3.7.3,測試問題已經解決。redis

 

在redisson升級的過程當中,報以下錯:網絡

redisson驗證uri的方式變了,在2.8.0中使用的是ip:port格式,在3.6.5中使用的是rediss://ip:port,須要添加前綴。分佈式

 redis鏈接超時,只有在NAT網絡環境纔會出現。測試

相關文章
相關標籤/搜索