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

java.io.StreamCorruptedException: invalid stream header: B055002D

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • slave-setup-plugin
    • None

      I'm trying to launch a slave on a Mainframe / zOS 1.12 system. I suspect that I am encountering some kind of codepage issue, but I am not sure. Below is the slave log during the launch.

      [03/15/12 08:26:48] [SSH] Starting sftp client.
      [03/15/12 08:26:48] [SSH] Copying latest slave.jar...
      [03/15/12 08:26:48] [SSH] Copied 257,564 bytes.
      [03/15/12 08:26:48] [SSH] Starting slave process: cd '/tmp' && /usr/lpp/java/J6.0/bin/java -Dfile.encoding=ISO8859-1 -jar slave.jar
      <===[JENKINS REMOTING CAPACITY]===>Exception in thread "main" java.io.StreamCorruptedException: invalid stream header: B055002D
      at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:797)
      at java.io.ObjectInputStream.<init>(ObjectInputStream.java:294)
      at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:40)
      at hudson.remoting.Channel.<init>(Channel.java:431)
      at hudson.remoting.Channel.<init>(Channel.java:366)
      at hudson.remoting.Channel.<init>(Channel.java:327)
      at hudson.remoting.Channel.<init>(Channel.java:323)
      at hudson.remoting.Channel.<init>(Channel.java:315)
      at hudson.remoting.Launcher.main(Launcher.java:405)
      at hudson.remoting.Launcher.runWithStdinStdout(Launcher.java:366)
      at hudson.remoting.Launcher.run(Launcher.java:206)
      at hudson.remoting.Launcher.main(Launcher.java:168)
      ERROR: Connection terminated
      ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins.
      java.io.IOException: Unexpected termination of the channel
      at hudson.remoting.Channel$ReaderThread.run(Channel.java:1133)
      Caused by: java.io.EOFException
      at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
      hudson.remoting.RequestAbortedException: hudson.remoting.RequestAbortedException: java.io.IOException: Unexpected termination of the channel
      at java.io.ObjectInputStream.readObject0(Unknown Source)
      at java.io.ObjectInputStream.readObject(Unknown Source)
      at hudson.remoting.Channel$ReaderThread.run(Channel.java:1127)
      at hudson.remoting.Request.call(Request.java:149)
      at hudson.remoting.Channel.call(Channel.java:681)
      at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:346)
      at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:314)
      at hudson.plugins.sshslaves.SSHLauncher.startSlave(SSHLauncher.java:454)
      at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:293)
      at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:200)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      Caused by: hudson.remoting.RequestAbortedException: java.io.IOException: Unexpected termination of the channel
      at hudson.remoting.Request.abort(Request.java:273)
      at hudson.remoting.Channel.terminate(Channel.java:732)
      at hudson.remoting.Channel$ReaderThread.run(Channel.java:1157)
      Caused by: java.io.IOException: Unexpected termination of the channel
      at hudson.remoting.Channel$ReaderThread.run(Channel.java:1133)
      Caused by: java.io.EOFException
      at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
      at java.io.ObjectInputStream.readObject0(Unknown Source)
      at java.io.ObjectInputStream.readObject(Unknown Source)
      at hudson.remoting.Channel$ReaderThread.run(Channel.java:1127)
      [03/15/12 08:26:49] [SSH] Connection closed.
      ERROR: [03/15/12 08:26:49] slave agent was terminated
      java.io.IOException: Unexpected termination of the channel
      at hudson.remoting.Channel$ReaderThread.run(Channel.java:1133)
      Caused by: java.io.EOFException
      at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
      at java.io.ObjectInputStream.readObject0(Unknown Source)
      at java.io.ObjectInputStream.readObject(Unknown Source)
      at hudson.remoting.Channel$ReaderThread.run(Channel.java:1127)

          [JENKINS-13091] java.io.StreamCorruptedException: invalid stream header: B055002D

          Xavier Nodet added a comment - - edited

          I would also be very interested in having this issue solved.
          Just saw it, using 1.456...

          I would guess that the agent doesn't know that it's running under EBCDIC encoding...

          Xavier Nodet added a comment - - edited I would also be very interested in having this issue solved. Just saw it, using 1.456... I would guess that the agent doesn't know that it's running under EBCDIC encoding...

          Jesse Glick added a comment -

          http://stackoverflow.com/a/13509010/12916 claims this can be solved with special launch parameters.

          Jesse Glick added a comment - http://stackoverflow.com/a/13509010/12916 claims this can be solved with special launch parameters.

          The text mode is for 8bit unsafe communication channel (such as telnet), and I'm not sure if this is one. SSH is 8bit safe.

          But without having access to zOS I don't think we can solve this.

          Kohsuke Kawaguchi added a comment - The text mode is for 8bit unsafe communication channel (such as telnet), and I'm not sure if this is one. SSH is 8bit safe. But without having access to zOS I don't think we can solve this.

          @Xavier Nodet - re: your EBCDIC comment. The original problem description shows a parameter -Dfile.encoding=ISO8859-1 to tell the zos Java engine that the slave.jar is an ASCII file: /usr/lpp/java/J6.0/bin/java -Dfile.encoding=ISO8859-1 -jar slave.jar, so the originator's issue should not be due to the EBCDIC encoding. I had an error message very similar to this one until I added the -Dfile.encoding: Exception in thread "main" java.io.StreamCorruptedException: invalid stream header: B055002D

          After adding that parameter to the Java invocation line, I was able to get the slave to connect okay. After getting the slave to connect, there is a second issue: Jenkins generates a /tmp/hudsonxxxxx.sh script, which contains ASCII text and not EBCDIC text(due to the use of the same -Dfile.encoding parameter named above, which sets file encoding for both input and output files.) After creating the /tmp/hudsonxxxxx.sh file, Jenkins invokes the sh (shell command) on the generated /tmp/hudsonxxxxx.sh, but since the file contains ASCII text but it is not tagged as ASCII (chtag command), the shell attempts to read it as EBCDIC, and so gets messed up. If the following environment variables are added to the environment, then any file generated by the Java engine (such as Jenkins creating the /tmp/hudsonxxxxx.sh file), will be tagged ASCII:
          IBM_JAVA_ENABLE_ASCII_FILETAG ON
          IBM_JAVA_OPTIONS "-Dfile.encoding=ISO8859-1 -Xnoargsconversion"

          (I'm not sure about the need of the -Xnoargsconversion in this case, but we require it for our application).

          My slave is connecting to a userid running tcsh, so I update the environment variable by setting Jenkin's "Prefix Start Slave Command" to:
          setenv IBM_JAVA_ENABLE_ASCII_FILETAG ON && setenv IBM_JAVA_OPTIONS "-Dfile.encoding=ISO8859-1 -Xnoargsconversion" && env &&

          I am running Jenkins 1.592, the zos version via uname is: OS/390 xxxx 23.0.
          the Java is: IBM J9 VM (build 2.6, JRE 1.7.0 z/OS s390x-64 20130617_152572 (JIT enabled, AOT enabled)

          My logon userid also sets the following environment variables at logon time to indicate to programs (other than Java) about the autotagging of ASCII files:

          _BPXK_AUTOCVT=ON
          _CEE_RUNOPTS=POSIX(ON),FILETAG(AUTOCVT,AUTOTAG)

          Rick Patterson added a comment - @Xavier Nodet - re: your EBCDIC comment. The original problem description shows a parameter -Dfile.encoding=ISO8859-1 to tell the zos Java engine that the slave.jar is an ASCII file: /usr/lpp/java/J6.0/bin/java -Dfile.encoding=ISO8859-1 -jar slave.jar, so the originator's issue should not be due to the EBCDIC encoding. I had an error message very similar to this one until I added the -Dfile.encoding: Exception in thread "main" java.io.StreamCorruptedException: invalid stream header: B055002D After adding that parameter to the Java invocation line, I was able to get the slave to connect okay. After getting the slave to connect, there is a second issue: Jenkins generates a /tmp/hudsonxxxxx.sh script, which contains ASCII text and not EBCDIC text(due to the use of the same -Dfile.encoding parameter named above, which sets file encoding for both input and output files.) After creating the /tmp/hudsonxxxxx.sh file, Jenkins invokes the sh (shell command) on the generated /tmp/hudsonxxxxx.sh, but since the file contains ASCII text but it is not tagged as ASCII (chtag command), the shell attempts to read it as EBCDIC, and so gets messed up. If the following environment variables are added to the environment, then any file generated by the Java engine (such as Jenkins creating the /tmp/hudsonxxxxx.sh file), will be tagged ASCII: IBM_JAVA_ENABLE_ASCII_FILETAG ON IBM_JAVA_OPTIONS "-Dfile.encoding=ISO8859-1 -Xnoargsconversion" (I'm not sure about the need of the -Xnoargsconversion in this case, but we require it for our application). My slave is connecting to a userid running tcsh, so I update the environment variable by setting Jenkin's "Prefix Start Slave Command" to: setenv IBM_JAVA_ENABLE_ASCII_FILETAG ON && setenv IBM_JAVA_OPTIONS "-Dfile.encoding=ISO8859-1 -Xnoargsconversion" && env && I am running Jenkins 1.592, the zos version via uname is: OS/390 xxxx 23.0. the Java is: IBM J9 VM (build 2.6, JRE 1.7.0 z/OS s390x-64 20130617_152572 (JIT enabled, AOT enabled) My logon userid also sets the following environment variables at logon time to indicate to programs (other than Java) about the autotagging of ASCII files: _BPXK_AUTOCVT=ON _CEE_RUNOPTS=POSIX(ON),FILETAG(AUTOCVT,AUTOTAG)

            kohsuke Kohsuke Kawaguchi
            walterk82 Walter Kacynski
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: