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

Jenkins 2 cli failes with "java.io.IOException: Unexpected termination of the channel"

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core
    • None
    • Centos 7, 64bit
      jenkins-2.7.4-1.1.noarch (rpm) LTS

      Symptom

      If you run a job via the cli with the "-s" switch and the job does not print any output for longer then 5 seconds, the connection dies with "java.io.IOException: Unexpected termination of the channel"

      Note: hudson.diyChunking is needed for https://issues.jenkins-ci.org/browse/JENKINS-35197

      /usr/bin/java -Dhudson.diyChunking=false -jar /usr/lib/jenkins/jenkins-cli.jar -s http://127.0.0.1:8080 -i /root/kenkins_ssh_key build -s JOB
      ...
             [log] Sep 22, 2016 9:15:40 AM hudson.remoting.SynchronousCommandTransport$ReaderThread run
             [log] SEVERE: I/O error in channel Chunked connection to http://127.0.0.1:8080/cli
             [log] java.io.IOException: Unexpected termination of the channel
             [log]        at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:73)
             [log] Caused by: java.io.EOFException
             [log]        at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2353)
             [log]        at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2822)
             [log]        at java.io.ObjectInputStream.readStreamH
      ...
      

      Problem

      The Jenkins built in Winstone-Jetty server uses a keep alive of 11,25 seconds (see https://github.com/jenkinsci/jenkins/blob/master/cli/src/main/java/hudson/cli/CLI.java#L156), while the jetty is configured with a 5 second timeout (see here https://github.com/jenkinsci/winstone/blob/master/README.md#command-line-options).

      Workaround
      Specify --httpKeepAliveTimeout=15000 to start of Jenkins

          [JENKINS-38623] Jenkins 2 cli failes with "java.io.IOException: Unexpected termination of the channel"

          Oleg Nenashev added a comment -

          The diagnosis looks reasonable to me. Keep Alive timeouts need to be aligned by default

          Please provide the full stacktrace. The provided snippet is not enough to diagnose the cause. Are you also sure that CLI client version is aligned with Jenkins version?

          Oleg Nenashev added a comment - The diagnosis looks reasonable to me. Keep Alive timeouts need to be aligned by default Please provide the full stacktrace. The provided snippet is not enough to diagnose the cause. Are you also sure that CLI client version is aligned with Jenkins version?

          Jon B added a comment -

          I have this problem too. I'm using the latest Jenkins 2 Docker image. I can't figure out how to set the keep alive timeout.

          Jon B added a comment - I have this problem too. I'm using the latest Jenkins 2 Docker image. I can't figure out how to set the keep alive timeout.

            Unassigned Unassigned
            elconas Robert Heinzmann
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: