Windows Agent Debugging Unexpected termination of the channel

I encounter a loss of connection, in the first minute (less than a minute in general), on my Windows agent only.

no problems with the Linux agent

I can’t determine the cause of this breakup.

Jenkins setup:
Jenkins 2.414.1
Serveur VM Ubuntu 22.04
Agent Windows 10
OpenSSH server

Connection by SSH

Remote system working directory
→ d:\jenkins
→ Reserve this node only for the jobs attached to it
Launch method
→ Launch agents via SSH
→ jenkins (SSHKEY user jenkins)
Host Key Verification Strategy
→ Known hosts file Verification Strategy

→ 22
→ C:\Java\jdk-19\bin\java.exe
→ C:\Java\jdk-11.0.17\bin\java.exe
JVM Options
→ -Xmx2048m -XX:MaxPermSize=512m
Prefix Start Agent Command
→ powershell -Command “java -version; cd D:\jenkins ; C:\Java\jdk-19\bin\java.exe -jar remoting.jar -workDir d:\jenkins -jar-cache d:\jenkins/remoting/jarCache” ; exit 0 ; rem ’
→ powershell -Command “java -version; cd D:\jenkins ; C:\Java\jdk-11.0.17\bin\java.exe -jar remoting.jar -workDir d:\jenkins -jar-cache d:\jenkins/remoting/jarCache” ; exit 0 ; rem ’
Suffix Start Agent Command
→ ’
Connection Timeout in Seconds
→ 210
Maximum Number of Retries
→ 10
Seconds To Wait Between Retries
→ 20
Use TCP_NODELAY flag on the SSH connection
→ True (test with False )

SSHLauncher{host=‘AGENT_WINDOWS’, port=22, credentialsId=‘credential_agent’, jvmOptions=‘-Xmx2048m -XX:MaxPermSize=512m’, java
Path=‘C:\Java\jdk-19\bin\java.exe’, prefixStartSlaveCmd=‘powershell -Command “java -version; cd D:\jenkins ; C:\Java\jdk
-19\bin\java.exe -jar remoting.jar -workDir d:\jenkins -jar-cache d:\jenkins/remoting/jarCache” ; exit 0 ; rem ‘’, suf
fixStartSlaveCmd=’‘’, launchTimeoutSeconds=210, maxNumRetries=10, retryWaitTime=20, sshHostKeyVerificationStrategy=hudso
n.plugins.sshslaves.verifiers.KnownHostsFileKeyVerificationStrategy, tcpNoDelay=false, trackCredentials=true}
[10/25/23 13:53:24] [SSH] Opening SSH connection to AGENT_WINDOWS:22.
Searching for AGENT_WINDOWS in /var/lib/jenkins/.ssh/known_hosts
Searching for AGENT_WINDOWS:22 in /var/lib/jenkins/.ssh/known_hosts
[10/25/23 13:53:24] [SSH] SSH host key matches key in Known Hosts file. Connection will be allowed.
[10/25/23 13:53:25] [SSH] Authentication successful.
[10/25/23 13:53:25] [SSH] The remote user’s environment is:
Set-Variable : Impossible de traiter la commande, car un ou plusieurs param�tres obligatoires sont
absents: Name.
Au caract�re Ligne:1 : 1

  • set
  •   + CategoryInfo          : InvalidArgument : (:) [Set-Variable], ParameterBindingException
      + FullyQualifiedErrorId : MissingMandatoryParameter,Microsoft.PowerShell.Commands.SetVariableC

[10/25/23 13:53:25] [SSH] Starting sftp client.
[10/25/23 13:53:26] [SSH] Copying latest remoting.jar…
Source agent hash is F65D6DACE88F37DB8F2081D956AAC3FE. Installed agent hash is F65D6DACE88F37DB8F2081D956AAC3FE
Verified agent jar. No update is necessary.
Expanded the channel window size to 4MB
[10/25/23 13:53:26] [SSH] Starting agent process: powershell -Command “java -version; cd D:\jenkins ; C:\Java\jdk-19\bin
\java.exe -jar remoting.jar -workDir d:\jenkins -jar-cache d:\jenkins/remoting/jarCache” ; exit 0 ; rem ‘cd “d:\jenkin
s” && C:\Java\jdk-19\bin\java.exe -Xmx2048m -XX:MaxPermSize=512m -jar remoting.jar -workDir d:\jenkins -jar-cache d:\je
java version “19.0.1” 2022-10-18
Java™ SE Runtime Environment (build 19.0.1+10-21)
Java HotSpot™ 64-Bit Server VM (build 19.0.1+10-21, mixed mode, sharing)
oct. 25, 2023 1:53:27 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using d:\jenkins\remoting as a remoting work directory
oct. 25, 2023 1:53:27 PM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
INFO: Both error and output logs will be printed to d:\jenkins\remoting
<===[JENKINS REMOTING CAPACITY]===>channel started
Remoting version: 3131.vf2b_b_798b_ce99
Launcher: SSHLauncher
Communication Protocol: Standard in/out
This is a Windows agent
Agent successfully connected and online

ERROR: Connection terminated
at java.base/$PeekInputStream.readFully(
at java.base/$BlockDataInputStream.readShort(
at java.base/
at java.base/
at hudson.remoting.ObjectInputStreamEx.(
at hudson.remoting.Command.readFrom(
at hudson.remoting.Command.readFrom(
at hudson.remoting.SynchronousCommandTransport$
Caused: Unexpected termination of the channel
at hudson.remoting.SynchronousCommandTransport$
ERROR: Socket connection to SSH server was lost Connection reset
at java.base/
at java.base/
at java.base/
at java.base/
at java.base/
at com.trilead.ssh2.crypto.cipher.CipherInputStream.readPlain(
at com.trilead.ssh2.transport.TransportConnection.receiveMessage(
at com.trilead.ssh2.transport.TransportManager.receiveLoop(
at com.trilead.ssh2.transport.TransportManager$
at java.base/
Agent JVM has not reported exit code before the socket was lost
[10/25/23 14:11:08] [SSH] Connection closed.