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

Invalid encoded sequence when connecting Windows Agent with Bitvise SSH Server

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • remoting, ssh-slaves-plugin
    • None

      I'm trying to launch a Windows Jenkins agent via SSH. In our company we have successfully used Bitvise SSH Server for the recent years (mainly for SFTP file operations) so we would like to avoid installing a second SSH server on those machines.

      Unfortunately we are getting the following stack trace when launching the agent:

      Exception in thread "main" java.io.IOException: Invalid encoded sequence encountered: 00 00 00 00
      	at hudson.remoting.BinarySafeStream$1._read(BinarySafeStream.java:194)
      	at hudson.remoting.BinarySafeStream$1.read(BinarySafeStream.java:125)
      	at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2663)
      	at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2679)
      	at java.io.ObjectInputStream$BlockDataInputStream.readUTFBody(ObjectInputStream.java:3426)
      	at java.io.ObjectInputStream$BlockDataInputStream.readUTF(ObjectInputStream.java:3226)
      	at java.io.ObjectInputStream.readUTF(ObjectInputStream.java:1133)
      	at java.io.ObjectStreamClass.readNonProxy(ObjectStreamClass.java:768)
      	at java.io.ObjectInputStream.readClassDescriptor(ObjectInputStream.java:891)
      	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1857)
      	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1751)
      	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2042)
      	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1573)
      	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)
      	at hudson.remoting.Capability.read(Capability.java:170)
      	at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:441)
      	at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:360)
      	at hudson.remoting.Launcher.main(Launcher.java:743)
      	at hudson.remoting.Launcher.runWithStdinStdout(Launcher.java:691)
      	at hudson.remoting.Launcher.run(Launcher.java:373)
      	at hudson.remoting.Launcher.main(Launcher.java:283)
      ERROR: Unexpected error in launching a agent. 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:340)
      	at hudson.remoting.Channel.terminate(Channel.java:1040)
      	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:94)
      	Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to SERVER01234
      		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1743)
      		at hudson.remoting.Request.call(Request.java:202)
      		at hudson.remoting.Channel.call(Channel.java:956)
      		at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:626)
      		at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:432)
      		at hudson.plugins.sshslaves.SSHLauncher.startAgent(SSHLauncher.java:1034)
      		at hudson.plugins.sshslaves.SSHLauncher.access$500(SSHLauncher.java:128)
      		at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:868)
      		at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:833)
      		at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      		at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      		at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      		at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: java.io.IOException: Unexpected termination of the channel
      	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:77)
      Caused by: java.io.EOFException
      	at java.base/java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2763)
      	at java.base/java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3258)
      	at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:873)
      	at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350)
      	at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:49)
      	at hudson.remoting.Command.readFrom(Command.java:140)
      	at hudson.remoting.Command.readFrom(Command.java:126)
      	at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:36)
      	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:63)
      [05/14/19 12:43:59] Launch failed - cleaning up connection
      ERROR: Connection terminated
      java.io.EOFException
      	at java.base/java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2763)
      	at java.base/java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3258)
      	at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:873)
      	at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:350)
      	at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:49)
      	at hudson.remoting.Command.readFrom(Command.java:140)
      	at hudson.remoting.Command.readFrom(Command.java:126)
      	at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:36)
      	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:63)
      Caused: java.io.IOException: Unexpected termination of the channel
      	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:77)
      

      I've additionally tried it with Win32-OpenSSH (https://github.com/PowerShell/Win32-OpenSSH) and the agent started successfully.

      Any idea what goes wrong with the Bitvise SSH Server implementation? Is there any way to further debug this? I attached the full master logs (anonymized) to this issue.

            Unassigned Unassigned
            jansohn Robin Jansohn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: