Description
Introduce a maxCommandExecutionTimeout parameter to the session.executeRemoteCommand method in Apache MINA SSHD. This is essential to prevent command executions from hanging indefinitely due to unresponsive commands or misbehaving remote servers.
Motivation
In our environment, we need to SSH into a large number of servers and execute commands. Occasionally, some servers are in a bad state, causing the command execution to hang indefinitely. This not only blocks the current session but also delays subsequent SSH operations to other servers.
To work around this, we currently have to create a custom execution channel and manually manage timeouts. Providing native support for a maxCommandExecutionTimeout within executeRemoteCommand would greatly simplify this process and improve robustness when dealing with unreliable targets.
// TODO use a configurable timeout Collection<ClientChannelEvent> waitMask = channel.waitFor(REMOTE_COMMAND_WAIT_EVENTS, 0L); if (waitMask.contains(ClientChannelEvent.TIMEOUT)) { throw new SocketTimeoutException("Failed to retrieve command result in time: " + command); }
Alternatives considered
No response
Additional context
No response
Description
Introduce a maxCommandExecutionTimeout parameter to the session.executeRemoteCommand method in Apache MINA SSHD. This is essential to prevent command executions from hanging indefinitely due to unresponsive commands or misbehaving remote servers.
Motivation
In our environment, we need to SSH into a large number of servers and execute commands. Occasionally, some servers are in a bad state, causing the command execution to hang indefinitely. This not only blocks the current session but also delays subsequent SSH operations to other servers.
To work around this, we currently have to create a custom execution channel and manually manage timeouts. Providing native support for a maxCommandExecutionTimeout within executeRemoteCommand would greatly simplify this process and improve robustness when dealing with unreliable targets.
// TODO use a configurable timeout Collection<ClientChannelEvent> waitMask = channel.waitFor(REMOTE_COMMAND_WAIT_EVENTS, 0L); if (waitMask.contains(ClientChannelEvent.TIMEOUT)) { throw new SocketTimeoutException("Failed to retrieve command result in time: " + command); }Alternatives considered
No response
Additional context
No response