Browse Source

Change ssh heartbeat type to IGNORE (#15858)

3.2.2-release-bak
Wenjun Ruan 7 months ago committed by GitHub
parent
commit
9437d276e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-ssh/src/main/java/org/apache/dolphinscheduler/plugin/datasource/ssh/SSHUtils.java
  2. 7
      dolphinscheduler-task-plugin/dolphinscheduler-task-remoteshell/src/main/java/org/apache/dolphinscheduler/plugin/task/remoteshell/RemoteExecutor.java

2
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-ssh/src/main/java/org/apache/dolphinscheduler/plugin/datasource/ssh/SSHUtils.java

@ -59,7 +59,7 @@ public class SSHUtils {
throw new Exception("Failed to add public key identity", e);
}
}
session.setSessionHeartbeat(SessionHeartbeatController.HeartbeatType.RESERVED, Duration.ofSeconds(3));
session.setSessionHeartbeat(SessionHeartbeatController.HeartbeatType.IGNORE, Duration.ofSeconds(3));
return session;
}
}

7
dolphinscheduler-task-plugin/dolphinscheduler-task-remoteshell/src/main/java/org/apache/dolphinscheduler/plugin/task/remoteshell/RemoteExecutor.java

@ -141,7 +141,6 @@ public class RemoteExecutor implements AutoCloseable {
}
}
cleanData(taskId);
log.error("Remote shell task failed");
return exitCode;
}
@ -232,8 +231,10 @@ public class RemoteExecutor implements AutoCloseable {
channel.open();
channel.waitFor(EnumSet.of(ClientChannelEvent.CLOSED), 0);
channel.close();
if (channel.getExitStatus() != 0) {
throw new TaskException("Remote shell task error, error message: " + err.toString());
Integer exitStatus = channel.getExitStatus();
if (exitStatus == null || exitStatus != 0) {
throw new TaskException(
"Remote shell task error, exitStatus: " + exitStatus + " error message: " + err);
}
return out.toString();
}

Loading…
Cancel
Save