Browse Source

[Bug][Service] All tasks that need to send attachment will fail due to chennel idle (#5442)

pull/3/MERGE
ruanwenjun 4 years ago committed by GitHub
parent
commit
fbef290cc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/handler/NettyClientHandler.java
  2. 6
      dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/handler/NettyServerHandler.java

6
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(); Command heartBeat = new Command();
heartBeat.setType(CommandType.HEART_BEAT); heartBeat.setType(CommandType.HEART_BEAT);
heartBeat.setBody(heartBeatData); heartBeat.setBody(heartBeatData);
ctx.writeAndFlush(heartBeat) ctx.channel().writeAndFlush(heartBeat)
.addListener(ChannelFutureListener.CLOSE_ON_FAILURE); .addListener(ChannelFutureListener.CLOSE_ON_FAILURE);
if (logger.isDebugEnabled()) {
logger.debug("Client send heart beat to: {}", ChannelUtils.getRemoteAddress(ctx.channel()));
}
} else { } else {
super.userEventTriggered(ctx, evt); super.userEventTriggered(ctx, evt);
} }

6
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) { private void processReceived(final Channel channel, final Command msg) {
final CommandType commandType = msg.getType(); 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<NettyRequestProcessor, ExecutorService> pair = processors.get(commandType); final Pair<NettyRequestProcessor, ExecutorService> pair = processors.get(commandType);
if (pair != null) { if (pair != null) {
Runnable r = () -> { Runnable r = () -> {

Loading…
Cancel
Save