Fixed - "Failed to submit a listener notification task. Event loop shut down?" error caused by PingConnectionHandler #3809

pull/5661/head
Nikita Koksharov 1 year ago
parent c15cd20acd
commit 5ac1856e13

@ -59,6 +59,10 @@ public class PingConnectionHandler extends ChannelInboundHandlerAdapter {
private void sendPing(ChannelHandlerContext ctx) { private void sendPing(ChannelHandlerContext ctx) {
RedisConnection connection = RedisConnection.getFrom(ctx.channel()); RedisConnection connection = RedisConnection.getFrom(ctx.channel());
if (connection.getRedisClient().isShutdown()) {
return;
}
RFuture<String> future; RFuture<String> future;
CommandData<?, ?> currentCommand = connection.getCurrentCommand(); CommandData<?, ?> currentCommand = connection.getCurrentCommand();
if (connection.getUsage() == 0 && (currentCommand == null || !currentCommand.isBlockingCommand())) { if (connection.getUsage() == 0 && (currentCommand == null || !currentCommand.isBlockingCommand())) {
@ -90,6 +94,10 @@ public class PingConnectionHandler extends ChannelInboundHandlerAdapter {
log.error("Unable to send PING command over channel: {}", ctx.channel(), cause); log.error("Unable to send PING command over channel: {}", ctx.channel(), cause);
} }
if (connection.getRedisClient().isShutdown()) {
return;
}
log.debug("channel: {} closed due to PING response timeout set in {} ms", ctx.channel(), config.getPingConnectionInterval()); log.debug("channel: {} closed due to PING response timeout set in {} ms", ctx.channel(), config.getPingConnectionInterval());
ctx.channel().close(); ctx.channel().close();
connection.getRedisClient().getConfig().getFailedNodeDetector().onPingFailed(); connection.getRedisClient().getConfig().getFailedNodeDetector().onPingFailed();

Loading…
Cancel
Save