Jenkins is a continuous integration tool, which is written in Java and provides very useful toolchain for DevOps software cycle.
After update to version 2.55 my master server was unable to connect to it’s own slaves. I began receiving messages like this after an update whilst trying to connect to slave:
ERROR: Connection terminated java.io.IOException: Unexpected termination of the channel at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:50) Caused by: java.io.EOFException at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2298) at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2767) at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:798) at java.io.ObjectInputStream.
(ObjectInputStream.java:298) at hudson.remoting.ObjectInputStreamEx. (ObjectInputStreamEx.java:40) at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:34) at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:48) ERROR: Socket connection to SSH server was lost
This stacktrace refers to remoting issue, which is wrong, because according to changelog, from this version it requires java 8. Although it isn’t said in clear, this requirement is mandatory only for slave jar files, server installation works well on Java 7 and even Java 6 (I checked both). And if we try to connect to our obsolete slave with the new slave.jar, connection will fail with this stack trace even if the required Java is installed on slave machine.
Therefore we have two ways now: we can update and/or make the Java 8 default on slave machines or downgrade Jenkins or somehow use the obsolete slave.jar. Second option is way more complicated and should be used only in case you cannot use modern java on your host.
I’ll skip java installation as perfectly described process in many HOWTO’s.
So, we have two installed JDKs:
# update-java-alternatives --list java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64 java-1.8.0-openjdk-amd64 1069 /usr/lib/jvm/java-1.8.0-openjdk-amd64
Now, we need to change default option to desired one:
# update-java-alternatives --set java-1.8.0-openjdk-amd64 update-alternatives: error: no alternatives for mozilla-javaplugin.so update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/IcedTeaPlugin.so
Since we rarely use Firefox on deployment servers, this message can be dismissed. Now our Jenkins slave must operate as usual.