Problem

Users might find a situation when SSH based jobs - either from a JS7 - JITL SSHJob template or from an SSH command line client - report the following problem:

Example for JITL SSHJob log output
2023-05-23 11:00:00.009+02:00 [MAIN] [Start] Job=Run_Ide_Check_lists, Agent (url=http://localhost:4445, id=agent_001, name=primaryAgent)
2023-05-23 11:00:00.034+02:00 [STDOUT] [INFO]Job Parameterization:
[INFO]Resulting Arguments:
[INFO] command=/bin/sleep 120 (source=JOB)
[INFO] create_env_vars=true (source=JOB)
[INFO] port=22 (source=JOB SSHProviderArguments)
[INFO] auth_file=... (source=JOB SSHProviderArguments)
[INFO] auth_method=PUBLICKEY (source=JOB SSHProviderArguments)
[INFO] host=localhost (source=JOB SSHProviderArguments)
[INFO] user=js7 (source=JOB SSHProviderArguments)
[INFO][connect]localhost:22 ...
[INFO][disconnected]localhost:22
2023-05-23 11:00:00.035+02:00 [MAIN] [End] [Error] returnCode=99, errorState=failed, reason=failed, msg=com.sos.jitl.jobs.ssh.exception.SOSJobSSHException: TransportException: Connection reset java.net.SocketException: Connection reset
com.sos.jitl.jobs.ssh.exception.SOSJobSSHException: TransportException: Connection reset java.net.SocketException: Connection reset
at com.sos.jitl.jobs.ssh.SSHJob.onOrderProcess(SSHJob.java:167)
at com.sos.jitl.jobs.common.ABlockingInternalJob$1.run(ABlockingInternalJob.java:137)
at js7.launcher.forjava.internal.BlockingInternalJobAdapter$$anon$1.$anonfun$run$2(BlockingInternalJobAdapter.scala:36)


The Connection reset error indicates that connection was closed by the server.

The problem might occur more or less frequently with the same job running fine and failing from time to time.

Analysis

Log output suggests that the job in fact did connect to the SSH server but that the connection was denied within short time (1ms):

Example for JITL SSHJob log output
2023-05-23 11:00:00.034+02:00 [STDOUT] [INFO]Job Parameterization:
...
[INFO][connect]localhost:22 ...
[INFO][disconnected]localhost:22
2023-05-23 11:00:00.035+02:00 [MAIN] [End] [Error] returnCode=99, errorState=failed, reason=failed, msg=com.sos.jitl.jobs.ssh.exception.SOSJobSSHException: TransportException: Connection reset java.net.SocketException: Connection reset


The problem does not suggest an error of the job but a limitation of resources with the SSH server:

  • SSH servers typically limit the number of incoming connections from the same source host.
    • For example this limit defaults to a maximum of 10 connections for OpenSSH.
  • Users can increase the limit with the SSH server's configuration.
    • For OpenSSH the configuration typically is added to the /etc/ssh/sshd_config file by use of settings like this:
      • MaxSessions 100
      • MaxStartups 100
    • For details check the OpenSSH manual.