Jenkins CLI returns 'invalid stream header'

Issue

Attempting to execute commands via Jenkins CLI (jenkins-cli.jar) results in something similar to this:

$ java -jar jenkins-cli.jar -s http://localhost:8080/ help
Aug 25, 2016 1:44:13 PM hudson.remoting.SynchronousCommandTransport$ReaderThread run
SEVERE: I/O error in channel Chunked connection to http://localhost:8080/cli
java.io.StreamCorruptedException: invalid stream header: 0A0A0A0A
	at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:806)
	at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
	at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:48)
	at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:34)
	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:48)

hudson.remoting.RequestAbortedException: java.io.StreamCorruptedException: invalid stream header: 0A0A0A0A
	at hudson.remoting.Request.abort(Request.java:297)
	at hudson.remoting.Channel.terminate(Channel.java:847)
	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:69)
	at ......remote call to Chunked connection to http://localhost:8080/cli(Native Method)
	at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
	at hudson.remoting.Request.call(Request.java:172)
	at hudson.remoting.Channel.call(Channel.java:780)
	at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:250)
	at hudson.remoting.$Proxy1.waitForProperty(Unknown Source)
	at hudson.remoting.Channel.waitForRemoteProperty(Channel.java:1258)
	at hudson.cli.CLI.<init>(CLI.java:147)
	at hudson.cli.CLIConnectionFactory.connect(CLIConnectionFactory.java:72)
	at hudson.cli.CLI._main(CLI.java:479)
	at hudson.cli.CLI.main(CLI.java:390)
Caused by: java.io.StreamCorruptedException: invalid stream header: 0A0A0A0A
	at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:806)
	at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
	at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:48)
	at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:34)
	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:48)

Environment

  • CloudBees Jenkins Enterprise
  • Jenkins
  • Jenkins CLI

Resolution

This is probably a result of hudson.diyChunking.

Check if diyChunking is enabled via the Script Console (JENKINS_URL/script) by running:

println System.getProperty("hudson.diyChunking")

If Result = true then read on.

You can disable diyChunking on the master by adding the Jenkins startup arg: -Dhudson.diyChunking=false. See How to add Java arguments to Jenkins if you need help.

Reference:

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.