前段时间发现线上有部分实例出现Redis异常,异常如下:
"stack_trace": "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=9, freeConnectionsCounter=49, freezed=false, freezeReason=null, client=[addr=redis://:7000], nodeType=MASTER, firstFail=0]]], connection: [id: 0xb1e1e677, L:/ ! R:], command: (DEL), params: [ITEMCENTER_V1_0]\n\tat org.redisson.command.CommandAsyncService.checkWriteFuture(CommandAsyncService.java:664)\n\tat org.redisson.command.CommandAsyncService.access$100(CommandAsyncService.java:84)\n\tat org.redisson.command.CommandAsyncService$9$1.operationComplete(CommandAsyncService.java:622)\n\tat org.redisson.command.CommandAsyncService$9$1.operationComplete(CommandAsyncService.java:619)\n\tat io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511)\n\tat io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:485)\n\tat io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:424)\n\tat io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:121)\n\tat io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetFailure(AbstractChannel.java:987)\n\tat io.netty.channel.AbstractChannel$AbstractUnsafe.write(AbstractChannel.java:869)\n\tat io.netty.channel.DefaultChannelPipeline$HeadContext.write(DefaultChannelPipeline.java:1391)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:738)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:730)\n\tat io.netty.channel.AbstractChannelHandlerContext.access$1900(AbstractChannelHandlerContext.java:38)\n\tat io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:1081)\n\tat io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:1128)\n\tat io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:1070)\n\tat io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)\n\tat io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)\n\tat io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:464)\n\tat io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)\n\tat io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)\n\tat java.lang.Thread.run(Thread.java:748)\nCaused by: java.nio.channels.ClosedChannelException: null\n\tat io.netty.channel.AbstractChannel$AbstractUnsafe.write(...)(Unknown Source)\n"
经排查分析,发现是因为Redisson链接池不足导致。
解决办法:
增加Redis主从链接池数量。
除非注明,否则均为李锋镝的博客原创文章,转载必须以链接形式标明本文链接