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

additional ssh command before ssh command that starts agent.jar results in StreamCorruptedException: invalid stream header: 090CACED

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Jenkins 1.563 running with OpenJDK 7

      I am using the option for creating slaves through command executed on master.

      This is the error:

      <===[JENKINS REMOTING CAPACITY]===>Exception in thread "main" java.io.StreamCorruptedException: invalid stream header: 090CACED
      	at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:804)
      	at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
      	at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:40)
      	at hudson.remoting.ChannelBuilder.makeTransport(ChannelBuilder.java:259)
      	at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:220)
      	at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:149)
      	at hudson.remoting.Launcher.main(Launcher.java:507)
      	at hudson.remoting.Launcher.runWithStdinStdout(Launcher.java:457)
      	at hudson.remoting.Launcher.run(Launcher.java:238)
      	at hudson.remoting.Launcher.main(Launcher.java:192)
      
      ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins
      hudson.remoting.RequestAbortedException: hudson.remoting.RequestAbortedException: java.io.IOException: Unexpected EOF
      	at hudson.remoting.RequestAbortedException.wrapForRethrow(RequestAbortedException.java:41)
      	at hudson.remoting.RequestAbortedException.wrapForRethrow(RequestAbortedException.java:34)
      	at hudson.remoting.Request.call(Request.java:174)
      	at hudson.remoting.Channel.call(Channel.java:739)
      	at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:443)
      	at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:339)
      	at hudson.slaves.CommandLauncher.launch(CommandLauncher.java:122)
      	at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:222)
      	at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:744)
      ERROR: Connection terminated
      java.io.IOException: Unexpected EOF
      	at hudson.remoting.ChunkedInputStream.readUntilBreak(ChunkedInputStream.java:90)
      	at hudson.remoting.ChunkedCommandTransport.readBlock(ChunkedCommandTransport.java:33)
      	at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:34)
      	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:48)
      Caused by: hudson.remoting.RequestAbortedException: java.io.IOException: Unexpected EOF
      	at hudson.remoting.Request.abort(Request.java:299)
      	at hudson.remoting.Channel.terminate(Channel.java:802)
      	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:69)
      Caused by: java.io.IOException: Unexpected EOF
      	at hudson.remoting.ChunkedInputStream.readUntilBreak(ChunkedInputStream.java:90)
      	at hudson.remoting.ChunkedCommandTransport.readBlock(ChunkedCommandTransport.java:33)
      	at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:34)
      	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:48)
      

      I have captured (with a `tee` command) this output sent by the slave:

      <===[JENKINS REMOTING CAPACITY]===>rO0ABXNyABpodWRzb24ucmVtb3RpbmcuQ2FwYWJpbGl0eQAAAAAAAAABAgABSgAEbWFza3hwAAAAAAAAAP4=
      

      I have tried slave options like -text and definition of encoding without success.
      My integration with Jenkins has come to a dead end

          [JENKINS-23110] additional ssh command before ssh command that starts agent.jar results in StreamCorruptedException: invalid stream header: 090CACED

          Ben Poole added a comment -

          I'm also experiencing this issue, was there any movement on it? Or a workaround?

          Thanks

          Ben Poole added a comment - I'm also experiencing this issue, was there any movement on it? Or a workaround? Thanks

          T Herzke added a comment -

          Details what the command on the server actually does to to launch the slave are missing from the report. I suppose it is a shell script that does something like

          ssh remote "rm -f /tmp/somefile"
          ssh remote "java -jar slave.jar" 

          In this case, the first ssh command consumes some bytes from the stdin for buffering purposes even if the remote command does not actually read stdin. The communication stram with the slave.jar, then, starts somewhere in the middle.

          See also the "Custom launcher" section at https://wiki.jenkins-ci.org/display/JENKINS/Remoting+issue .

          Suggestion to close this issue.

          T Herzke added a comment - Details what the command on the server actually does to to launch the slave are missing from the report. I suppose it is a shell script that does something like ssh remote "rm -f /tmp/somefile" ssh remote "java -jar slave.jar" In this case, the first ssh command consumes some bytes from the stdin for buffering purposes even if the remote command does not actually read stdin. The communication stram with the slave.jar, then, starts somewhere in the middle. See also the "Custom launcher" section at https://wiki.jenkins-ci.org/display/JENKINS/Remoting+issue . Suggestion to close this issue.

          Josh Soref added a comment -

          I'd suggest improving the error message (and I'll provide a patch).

          Currently the error says:

          ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins
          

          A better message would say something like:

          ERROR: Failed to properly communicate with agent. This could be because a program (especially an additional ssh command before the one used to start agent.jar) consumed input which was destined for the agent. -- Otherwise, this could be a bug in Jenkins.

          Beyond that, it seems to me like the Jenkins server side should be able to wait for the agent's hello world message and only start sending bytes upon receiving that. Presumably that would fix the problem here.

          (FWIW, I just hit this today running 2.97.)

          Josh Soref added a comment - I'd suggest improving the error message (and I'll provide a patch). Currently the error says: ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins A better message would say something like: ERROR: Failed to properly communicate with agent. This could be because a program (especially an additional ssh command before the one used to start agent.jar) consumed input which was destined for the agent. -- Otherwise, this could be a bug in Jenkins. Beyond that, it seems to me like the Jenkins server side should be able to wait for the agent's hello world message and only start sending bytes upon receiving that. Presumably that would fix the problem here. (FWIW, I just hit this today running 2.97.)

            Unassigned Unassigned
            gdm85 Giuseppe Mazzotta
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: