Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-42856

Unable to launch Windows slaves using Microsoft OpenSSH: Unexpected termination of the channel

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • ssh-slaves-plugin
    • None
    • Windows 2012 R2 master and slaves, Jenkins 2.32.3 LTS, Win32-OpenSSH 0.0.10.0, SSH Slaves plugin 1.14

      As a first step to being able to use the VMware plugin to spawn slaves automatically, I'm trying to get ssh slave connectivity to work. Normally I use Java Web Start for permanent slaves, which works fine, but I have no way to use that with a dynamic slave (without turning off the connect security and forgoing having a secret in the JNLP command).

      I've installed the Microsoft SSH port (Win32-OpenSSH) for sshd, and Cygwin to get the "true" utility that Jenkins expects to call, but my attempts to launch the agent fail almost immediately (after copying the slave.jar file), with the following log:

      [03/16/17 14:35:26] [SSH] Opening SSH connection to myserver:22.
      [03/16/17 14:35:31] [SSH] Authentication successful.
      [03/16/17 14:35:34] [SSH] The remote users environment is:
      [03/16/17 14:35:36] [SSH] Starting sftp client.
      [03/16/17 14:35:39] [SSH] Copying latest slave.jar...
      [03/16/17 14:36:00] [SSH] Copied 717,563 bytes.
      Expanded the channel window size to 4MB
      [03/16/17 14:36:00] [SSH] Starting slave process: cd "C:\Jenkins" && "C:\Program Files\Java\jre1.8.0_121\bin\java"  -jar slave.jar
      <===[JENKINS REMOTING CAPACITY]===><===[JENKINS REMOTING CAPACITY]===>ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins.
      hudson.remoting.RequestAbortedException: java.io.IOException: Unexpected termination of the channel
      	at hudson.remoting.Request.abort(Request.java:307)
      	at hudson.remoting.Channel.terminate(Channel.java:888)
      	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:92)
      	at ......remote call to myserver(Native Method)
      	at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1537)
      	at hudson.remoting.Request.call(Request.java:172)
      	at hudson.remoting.Channel.call(Channel.java:821)
      	at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:516)
      	at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:389)
      	at hudson.plugins.sshslaves.SSHLauncher.startSlave(SSHLauncher.java:989)
      	at hudson.plugins.sshslaves.SSHLauncher.access$400(SSHLauncher.java:139)
      	at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:738)
      	at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:719)
      	at java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at java.lang.Thread.run(Unknown Source)
      Caused by: java.io.IOException: Unexpected termination of the channel
      	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:73)
      Caused by: java.io.EOFException
      	at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
      	at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
      	at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
      	at java.io.ObjectInputStream.<init>(Unknown Source)
      	at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:48)
      	at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:34)
      	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:59)
      [03/16/17 14:36:09] Launch failed - cleaning up connection
      ERROR: Connection terminated
      java.io.IOException: Unexpected termination of the channel
      	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:73)
      Caused by: java.io.EOFException
      	at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
      	at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
      	at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
      	at java.io.ObjectInputStream.<init>(Unknown Source)
      	at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:48)
      	at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:34)
      	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:59)
      [03/16/17 14:36:09] [SSH] Connection closed.

      I've searched and found a number of cases of the "This is probably a bug in Jenkins." error in launching a slave, but seemingly not this exact one. It seems to be that the connection or process is being terminated on the slave side but I can't figure out by what.

      How can this be fixed or worked around?

      EDIT (March 17, 2017): Per stephenconnolly and my own testing, this appears to be n incompatibility between the Jenkins SSH Slaves plugin and a bug in the Microsoft's Win32-OpenSSH port specifically. When I switched the slave node to run Cygwin's OpenSSH, it worked perfectly.

            ifernandezcalvo Ivan Fernandez Calvo
            medianick Nick Jones
            Votes:
            5 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: