From fbef290cc5e611bfee7a430472b2b2774dd6d921 Mon Sep 17 00:00:00 2001 From: ruanwenjun <861923274@qq.com> Date: Tue, 11 May 2021 03:03:52 +0800 Subject: [PATCH] [Bug][Service] All tasks that need to send attachment will fail due to chennel idle (#5442) --- .../dolphinscheduler/remote/handler/NettyClientHandler.java | 6 ++++-- .../dolphinscheduler/remote/handler/NettyServerHandler.java | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/handler/NettyClientHandler.java b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/handler/NettyClientHandler.java index c057850947..e122df4f29 100644 --- a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/handler/NettyClientHandler.java +++ b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/handler/NettyClientHandler.java @@ -184,9 +184,11 @@ public class NettyClientHandler extends ChannelInboundHandlerAdapter { Command heartBeat = new Command(); heartBeat.setType(CommandType.HEART_BEAT); heartBeat.setBody(heartBeatData); - ctx.writeAndFlush(heartBeat) + ctx.channel().writeAndFlush(heartBeat) .addListener(ChannelFutureListener.CLOSE_ON_FAILURE); - + if (logger.isDebugEnabled()) { + logger.debug("Client send heart beat to: {}", ChannelUtils.getRemoteAddress(ctx.channel())); + } } else { super.userEventTriggered(ctx, evt); } diff --git a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/handler/NettyServerHandler.java b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/handler/NettyServerHandler.java index 322dfae9b1..2be00c914a 100644 --- a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/handler/NettyServerHandler.java +++ b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/handler/NettyServerHandler.java @@ -116,6 +116,12 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { */ private void processReceived(final Channel channel, final Command msg) { final CommandType commandType = msg.getType(); + if (CommandType.HEART_BEAT.equals(commandType)) { + if (logger.isDebugEnabled()) { + logger.debug("server receive heart beat from: host: {}", ChannelUtils.getRemoteAddress(channel)); + } + return; + } final Pair pair = processors.get(commandType); if (pair != null) { Runnable r = () -> {