内容目录
问题复现
org.redisson.client.WriteRedisConnectionException: Unable to send command! Node source: NodeSource [slot=null, addr=null, redisClient=null, redirect=null, entry=MasterSlaveEntry [masterEntry=[freeSubscribeConnectionsAmount=1, freeSubscribeConnectionsCounter=50, freeConnectionsAmount=31, freeConnectionsCounter=63, freezed=false, freezeReason=null, client=[addr=redis://dummy-host-redis:6379], nodeTy pe=MASTER, firstFail=0]]], connection: [id: 0xc8d0cc91, L:/10.137.1.134:40324 ! R:dummy-host-redis/10.97.181.70:6379], command: (EVAL), params: [if (redis.call('exists', KEYS[1]) == 0) then redis.call('hset', KEYS[1], ARGV[2], 1); redis.call('pe..., 1, generateNo, 10000, 9ebeda97-33aa-4ffc-bbfe-5d9133485df7:57]
at org.redisson.command.CommandAsyncService.checkWriteFuture(CommandAsyncService.java:701)
at org.redisson.command.CommandAsyncService.access$100(CommandAsyncService.java:85)
at org.redisson.command.CommandAsyncService$9$1.operationComplete(CommandAsyncService.java:659)
at org.redisson.command.CommandAsyncService$9$1.operationComplete(CommandAsyncService.java:656)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:502)
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:476)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:415)
at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:540)
at io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:533)
at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:114)
at io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetFailure(AbstractChannel.java:1018)
at io.netty.channel.AbstractChannel$AbstractUnsafe.write(AbstractChannel.java:874)
at io.netty.channel.DefaultChannelPipeline$HeadContext.write(DefaultChannelPipeline.java:1365)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:706)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:698)
at io.netty.channel.AbstractChannelHandlerContext.access$1700(AbstractChannelHandlerContext.java:38)
at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:1091)
at io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:1138)
at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:1062)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:495)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:75)
Caused by: io.netty.channel.ExtendedClosedChannelException: null
at io.netty.channel.AbstractChannel$AbstractUnsafe.write(...)(Unknown Source)
问题场景
使用Redisson分布式锁
怀疑
- Redis连接被占用完
- Redis客户端连接池过小
- Redisson客户端Bug
排查
-
排除Redis 连接被占用
127.0.0.1:6379> config get maxclients 1) "maxclients" 2) "10000"
-
Redis客户端连接个数: 默认50, 最大100,可能性不大因为并发不高
-
Redisson Bug
https://github.com/redisson/redisson/issues/2680
https://github.com/redisson/redisson/issues/1811
https://blog.csdn.net/sinat_32023305/article/details/108704328
解决方案
升级Redisson到3.33.0