title: Jenkins Slave Issue - invalid stream header: 099EACED
body: <p>Jenkins 2.7.4 was installed in the RedHat Server and Linux Slaves is configured by Selecting "Launch agent via execution of command on master" option. We created a Shell script and it works fine in the Jenkins version 2.7.4.</p>
  
  <p>Now we upgraded the Jenkins to 2.121.1. Now the same script throws an error </p>
  
  <blockquote>
    <p>&lt;===[JENKINS REMOTING CAPACITY]===>Exception in thread "main"
    java.io.StreamCorruptedException: invalid stream header: 099EACED     at
    java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:808)
      at java.io.ObjectInputStream.(ObjectInputStream.java:301)     at
    hudson.remoting.ObjectInputStreamEx.(ObjectInputStreamEx.java:48)
      at
    hudson.remoting.ChannelBuilder.makeTransport(ChannelBuilder.java:478)
      at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:433)
      at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:354)    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: Connection
    terminated ERROR: Unexpected error in launching an agent. This is
    probably a bug in Jenkins java.io.IOException: Unexpected EOF     at
    hudson.remoting.ChunkedInputStream.readUntilBreak(ChunkedInputStream.java:99)
      at
    hudson.remoting.ChunkedCommandTransport.readBlock(ChunkedCommandTransport.java:39)
      at
    hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:35)
      at
    hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:63)
    ERROR: Process terminated with exit code 1 java.io.IOException:
    Unexpected EOF    at
    hudson.remoting.ChunkedInputStream.readUntilBreak(ChunkedInputStream.java:99)
      at
    hudson.remoting.ChunkedCommandTransport.readBlock(ChunkedCommandTransport.java:39)
      at
    hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:35)
      at
    hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:63)
    Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to
    rtt-ci-euhrhd0036vdeas        at
    hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741)
          at hudson.remoting.Request.call(Request.java:202)       at
    hudson.remoting.Channel.call(Channel.java:954)        at
    hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:549)        at
    hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:416)        at
    hudson.slaves.CommandLauncher.launch(CommandLauncher.java:153)        at
    hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:288)        at
    jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
          at
    jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71)
          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:
    hudson.remoting.RequestAbortedException   at
    hudson.remoting.Request.abort(Request.java:340)   at
    hudson.remoting.Channel.terminate(Channel.java:1038)  at
    hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:96)</p>
  </blockquote>
  
  <p>If I disable the SSHD port in Manage Jenkins -> Configure Security, Then I can able to launch my slave. But In my script, I will trigger one job using Jenkins-cli.jar to copy the binaries from master to slaves. 
  <code>java -jar jenkins-cli.jar -s http://localhost:8080 --ssh -user username -i ~/.ssh/id_rsa build RTT/RTT-CI-Tools/RTT-CI-Tools-Distribute -s -p SLAVE_REGEX=slave name</code> 
  I'm getting a message as </p>
  
  <pre><code>"WARNING: No header 'X-SSH-Endpoint' returned by Jenkins" 
  </code></pre>
  
  <p>and build is not getting triggered. I have also tried by replacing -ssh to -http in jenkins-cli.jar command,</p>
  
  <p><code>java -jar jenkins-cli.jar -s http://localhost:8080 -http -auth username:60b3450a883a2519592af84cdcd0d224 build $CI_JOB -s -p SLAVE_REGEX=$SLAVEHOST</code></p>
  
  <p>It triggers the job. Again unable to launch the slave machine,</p>
  
  <blockquote>
    <p>&lt;===[JENKINS REMOTING CAPACITY]===>Exception in thread "main"
    java.io.StreamCorruptedException: invalid stream header: 099FACED     at
    java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:808)
      at java.io.ObjectInputStream.(ObjectInputStream.java:301)     at
    hudson.remoting.ObjectInputStreamEx.(ObjectInputStreamEx.java:48)
      at
    hudson.remoting.ChannelBuilder.makeTransport(ChannelBuilder.java:478)
      at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:433)
      at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:354)    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) usage: ssh
    [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
               [-D [bind_address:]port] [-e escape_char] [-F configfile]
               [-i identity_file] [-L [bind_address:]port:host:hostport]
               [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
               [-R [bind_address:]port:host:hostport] [-S ctl_path]
               [-W host:port] [-w local_tun[:remote_tun]]
               [user@]hostname [command] ERROR: Unexpected error in launching an agent. This is probably a bug in Jenkins ERROR:
    Connection terminated java.io.IOException: Unexpected EOF</p>
  </blockquote>
  
  <p>How to fix this issue</p>