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

MismatchedInputException: No content to map due to end-of-input

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • kubernetes-plugin
    • None

      After upgrading to version 1.15.1 we're unable to create pods with this error:

      WARNING: Error in provisioning; agent=KubernetesSlave name: jdk8-rvt2j, template=PodTemplate{inheritFrom='', name='jdk8', namespace='', instanceCap=8, idleMinutes=120, label='java java8', serviceAccount='jenkins-slaves', nodeSelector='', nodeUsageMode=NORMAL, workspaceVolume=EmptyDirWorkspaceVolume [memory=false], volumes=[SecretVolume [mountPath=/home/jenkins/nexus-jenkins-auth, secretName=nexus-jenkins-auth, defaultMode=null], SecretVolume [mountPath=/home/jenkins/sonar-jenkins-auth, secretName=sonar-jenkins-auth, defaultMode=null], EmptyDirVolume [mountPath=/tmp, memory=false]], containers=[ContainerTemplate{name='jnlp', image='docker-registry.default.svc:5000/ci-devtools/jenkins-slave-java8', alwaysPullImage=true, workingDir='/tmp', command='', args='${computer.jnlpmac} ${computer.name}', ttyEnabled=true, resourceRequestCpu='1', resourceRequestMemory='2Gi', resourceLimitCpu='1', resourceLimitMemory='4Gi', livenessProbe=org.csanchez.jenkins.plugins.kubernetes.ContainerLivenessProbe@23dd88f}], envVars=[KeyValueEnvVar [getValue()=/home/jenkins, getKey()=HOME], KeyValueEnvVar [getValue()=-Xmx1024m, getKey()=JAVA_OPTS], KeyValueEnvVar [getValue()=-Duser.timezone=Europe/Berlin -Djava.security.egd=file:/dev/urandom -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8, getKey()=JAVA_TOOL_OPTIONS]]}
      io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
      	at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:64)
      	at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:53)
      	at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:238)
      	at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:191)
      	at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:178)
      	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.unmarshal(OperationSupport.java:495)
      	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.load(BaseOperation.java:331)
      	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.load(BaseOperation.java:67)
      	at org.csanchez.jenkins.plugins.kubernetes.PodTemplateUtils.parseFromYaml(PodTemplateUtils.java:509)
      	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
      	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
      	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
      	at org.csanchez.jenkins.plugins.kubernetes.PodTemplateBuilder.build(PodTemplateBuilder.java:201)
      	at org.csanchez.jenkins.plugins.kubernetes.PodTemplate.build(PodTemplate.java:719)
      	at org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.launch(KubernetesLauncher.java:103)
      	at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:294)
      	at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
      	at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input
       at [Source: (BufferedInputStream); line: 1, column: 1]
      	at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
      	at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4145)
      	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4000)
      	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3077)
      	at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:236)
      	... 23 more
      
      

      Switching back to 1.14.9 and works like charme

          [JENKINS-57116] MismatchedInputException: No content to map due to end-of-input

          1.) Using scripted

          2) Using admin page

          3. Also not using yaml

          Martin Reinhardt added a comment - 1.) Using scripted 2) Using admin page 3. Also not using yaml

          can you provide from your config.xml

          the first line, something like <?xml version='1.1' encoding='UTF-8'?>
          the yaml/yamls entries inside your podTemplate config <org.csanchez.jenkins.plugins.kubernetes.PodTemplate> paying attention to encoding

          Carlos Sanchez added a comment - can you provide from your config.xml the first line, something like <?xml version='1.1' encoding='UTF-8'?> the yaml / yamls entries inside your podTemplate config <org.csanchez.jenkins.plugins.kubernetes.PodTemplate> paying attention to encoding

          Josh Chandler added a comment -

          First line of config.xml:

          <?xml version='1.1' encoding='UTF-8'?> 

           

          I'm not seeing any yaml in my podTemplate; here's what I've got in config.xml:

          <org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
            <inheritFrom></inheritFrom>
            <name>jnlp-buildpod</name>
            <namespace>ci</namespace>
            <privileged>false</privileged>
            <capOnlyOnAlivePods>false</capOnlyOnAlivePods>
            <alwaysPullImage>false</alwaysPullImage>
            <instanceCap>10</instanceCap>
            <slaveConnectTimeout>600</slaveConnectTimeout>
            <idleMinutes>30</idleMinutes>
            <activeDeadlineSeconds>0</activeDeadlineSeconds>
            <label></label>
            <serviceAccount>ops-jenkins</serviceAccount>
            <nodeSelector></nodeSelector>
            <nodeUsageMode>NORMAL</nodeUsageMode>
            <customWorkspaceVolumeEnabled>false</customWorkspaceVolumeEnabled>
            <workspaceVolume class="org.csanchez.jenkins.plugins.kubernetes.volumes.workspace.EmptyDirWorkspaceVolume">
              <memory>false</memory>
            </workspaceVolume>
            <volumes>
              <org.csanchez.jenkins.plugins.kubernetes.volumes.HostPathVolume>
                <mountPath>/var/run/docker.sock</mountPath>
                <hostPath>/var/run/docker.sock</hostPath>
              </org.csanchez.jenkins.plugins.kubernetes.volumes.HostPathVolume>
            </volumes>
            <containers>
              <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
                <name>docker</name>
                <image>docker:18.09.1-dind</image>
                <privileged>true</privileged>
                <alwaysPullImage>false</alwaysPullImage>
                <workingDir>/home/jenkins</workingDir>
                <command>/bin/sh -c</command>
                <args>cat</args>
                <ttyEnabled>true</ttyEnabled>
                <resourceRequestCpu>500m</resourceRequestCpu>
                <resourceRequestMemory>1Gi</resourceRequestMemory>
                <resourceLimitCpu>1</resourceLimitCpu>
                <resourceLimitMemory>2Gi</resourceLimitMemory>
                <envVars/>
                <ports/>
                <livenessProbe>
                  <execArgs></execArgs>
                  <timeoutSeconds>0</timeoutSeconds>
                  <initialDelaySeconds>0</initialDelaySeconds>
                  <failureThreshold>0</failureThreshold>
                  <periodSeconds>0</periodSeconds>
                  <successThreshold>0</successThreshold>
                </livenessProbe>
              </org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
              <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
                <name>kubectl</name>
                <image>lachlanevenson/k8s-kubectl:v1.10.12</image>
                <privileged>false</privileged>
                <alwaysPullImage>false</alwaysPullImage>
                <workingDir>/home/jenkins</workingDir>
                <command>/bin/sh -c</command>
                <args>cat</args>
                <ttyEnabled>true</ttyEnabled>
                <resourceRequestCpu>100m</resourceRequestCpu>
                <resourceRequestMemory>500Mi</resourceRequestMemory>
                <resourceLimitCpu>100m</resourceLimitCpu>
                <resourceLimitMemory>500Mi</resourceLimitMemory>
                <envVars/>
                <ports/>
                <livenessProbe>
                  <execArgs></execArgs>
                  <timeoutSeconds>0</timeoutSeconds>
                  <initialDelaySeconds>0</initialDelaySeconds>
                  <failureThreshold>0</failureThreshold>
                  <periodSeconds>0</periodSeconds>
                  <successThreshold>0</successThreshold>
                </livenessProbe>
              </org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
              <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
                <name>cmdtools</name>
                <image>alpine:3.8</image>
                <privileged>false</privileged>
                <alwaysPullImage>false</alwaysPullImage>
                <workingDir>/home/jenkins</workingDir>
                <command>/bin/sh -c</command>
                <args>cat</args>
                <ttyEnabled>true</ttyEnabled>
                <resourceRequestCpu>100m</resourceRequestCpu>
                <resourceRequestMemory>100Mi</resourceRequestMemory>
                <resourceLimitCpu>100m</resourceLimitCpu>
                <resourceLimitMemory>100Mi</resourceLimitMemory>
                <envVars/>
                <ports/>
                <livenessProbe>
                  <execArgs></execArgs>
                  <timeoutSeconds>0</timeoutSeconds>
                  <initialDelaySeconds>0</initialDelaySeconds>
                  <failureThreshold>0</failureThreshold>
                  <periodSeconds>0</periodSeconds>
                  <successThreshold>0</successThreshold>
                </livenessProbe>
              </org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
              <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
                <name>cmdtools-python</name>
                <image>python:3.6.7</image>
                <privileged>false</privileged>
                <alwaysPullImage>false</alwaysPullImage>
                <workingDir>/home/jenkins</workingDir>
                <command>/bin/sh -c</command>
                <args>cat</args>
                <ttyEnabled>true</ttyEnabled>
                <resourceRequestCpu></resourceRequestCpu>
                <resourceRequestMemory></resourceRequestMemory>
                <resourceLimitCpu></resourceLimitCpu>
                <resourceLimitMemory></resourceLimitMemory>
                <envVars/>
                <ports/>
                <livenessProbe>
                  <execArgs></execArgs>
                  <timeoutSeconds>0</timeoutSeconds>
                  <initialDelaySeconds>0</initialDelaySeconds>
                  <failureThreshold>0</failureThreshold>
                  <periodSeconds>0</periodSeconds>
                  <successThreshold>0</successThreshold>
                </livenessProbe>
              </org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
              <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
                <name>cmdtools-centos</name>
                <image>centos:7.6.1810</image>
                <privileged>false</privileged>
                <alwaysPullImage>false</alwaysPullImage>
                <workingDir>/home/jenkins</workingDir>
                <command>/bin/sh -c</command>
                <args>cat</args>
                <ttyEnabled>true</ttyEnabled>
                <resourceRequestCpu></resourceRequestCpu>
                <resourceRequestMemory></resourceRequestMemory>
                <resourceLimitCpu></resourceLimitCpu>
                <resourceLimitMemory></resourceLimitMemory>
                <envVars/>
                <ports/>
                <livenessProbe>
                  <execArgs></execArgs>
                  <timeoutSeconds>0</timeoutSeconds>
                  <initialDelaySeconds>0</initialDelaySeconds>
                  <failureThreshold>0</failureThreshold>
                  <periodSeconds>0</periodSeconds>
                  <successThreshold>0</successThreshold>
                </livenessProbe>
              </org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
            </containers>
            <envVars/>
            <annotations/>
            <imagePullSecrets/>
            <nodeProperties/>
            <podRetention class="org.csanchez.jenkins.plugins.kubernetes.pod.retention.Default"/>
          </org.csanchez.jenkins.plugins.kubernetes.PodTemplate> 

          Josh Chandler added a comment - First line of config.xml: <?xml version= '1.1' encoding= 'UTF-8' ?>   I'm not seeing any yaml in my podTemplate; here's what I've got in config.xml: <org.csanchez.jenkins.plugins.kubernetes.PodTemplate> <inheritFrom></inheritFrom> <name>jnlp-buildpod</name> <namespace>ci</namespace> <privileged> false </privileged> <capOnlyOnAlivePods> false </capOnlyOnAlivePods> <alwaysPullImage> false </alwaysPullImage> <instanceCap>10</instanceCap> <slaveConnectTimeout>600</slaveConnectTimeout> <idleMinutes>30</idleMinutes> <activeDeadlineSeconds>0</activeDeadlineSeconds> <label></label> <serviceAccount>ops-jenkins</serviceAccount> <nodeSelector></nodeSelector> <nodeUsageMode>NORMAL</nodeUsageMode> <customWorkspaceVolumeEnabled> false </customWorkspaceVolumeEnabled> <workspaceVolume class= "org.csanchez.jenkins.plugins.kubernetes.volumes.workspace.EmptyDirWorkspaceVolume" > <memory> false </memory> </workspaceVolume> <volumes> <org.csanchez.jenkins.plugins.kubernetes.volumes.HostPathVolume> <mountPath>/ var /run/docker.sock</mountPath> <hostPath>/ var /run/docker.sock</hostPath> </org.csanchez.jenkins.plugins.kubernetes.volumes.HostPathVolume> </volumes> <containers> <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate> <name>docker</name> <image>docker:18.09.1-dind</image> <privileged> true </privileged> <alwaysPullImage> false </alwaysPullImage> <workingDir>/home/jenkins</workingDir> <command>/bin/sh -c</command> <args>cat</args> <ttyEnabled> true </ttyEnabled> <resourceRequestCpu>500m</resourceRequestCpu> <resourceRequestMemory>1Gi</resourceRequestMemory> <resourceLimitCpu>1</resourceLimitCpu> <resourceLimitMemory>2Gi</resourceLimitMemory> <envVars/> <ports/> <livenessProbe> <execArgs></execArgs> <timeoutSeconds>0</timeoutSeconds> <initialDelaySeconds>0</initialDelaySeconds> <failureThreshold>0</failureThreshold> <periodSeconds>0</periodSeconds> <successThreshold>0</successThreshold> </livenessProbe> </org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate> <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate> <name>kubectl</name> <image>lachlanevenson/k8s-kubectl:v1.10.12</image> <privileged> false </privileged> <alwaysPullImage> false </alwaysPullImage> <workingDir>/home/jenkins</workingDir> <command>/bin/sh -c</command> <args>cat</args> <ttyEnabled> true </ttyEnabled> <resourceRequestCpu>100m</resourceRequestCpu> <resourceRequestMemory>500Mi</resourceRequestMemory> <resourceLimitCpu>100m</resourceLimitCpu> <resourceLimitMemory>500Mi</resourceLimitMemory> <envVars/> <ports/> <livenessProbe> <execArgs></execArgs> <timeoutSeconds>0</timeoutSeconds> <initialDelaySeconds>0</initialDelaySeconds> <failureThreshold>0</failureThreshold> <periodSeconds>0</periodSeconds> <successThreshold>0</successThreshold> </livenessProbe> </org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate> <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate> <name>cmdtools</name> <image>alpine:3.8</image> <privileged> false </privileged> <alwaysPullImage> false </alwaysPullImage> <workingDir>/home/jenkins</workingDir> <command>/bin/sh -c</command> <args>cat</args> <ttyEnabled> true </ttyEnabled> <resourceRequestCpu>100m</resourceRequestCpu> <resourceRequestMemory>100Mi</resourceRequestMemory> <resourceLimitCpu>100m</resourceLimitCpu> <resourceLimitMemory>100Mi</resourceLimitMemory> <envVars/> <ports/> <livenessProbe> <execArgs></execArgs> <timeoutSeconds>0</timeoutSeconds> <initialDelaySeconds>0</initialDelaySeconds> <failureThreshold>0</failureThreshold> <periodSeconds>0</periodSeconds> <successThreshold>0</successThreshold> </livenessProbe> </org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate> <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate> <name>cmdtools-python</name> <image>python:3.6.7</image> <privileged> false </privileged> <alwaysPullImage> false </alwaysPullImage> <workingDir>/home/jenkins</workingDir> <command>/bin/sh -c</command> <args>cat</args> <ttyEnabled> true </ttyEnabled> <resourceRequestCpu></resourceRequestCpu> <resourceRequestMemory></resourceRequestMemory> <resourceLimitCpu></resourceLimitCpu> <resourceLimitMemory></resourceLimitMemory> <envVars/> <ports/> <livenessProbe> <execArgs></execArgs> <timeoutSeconds>0</timeoutSeconds> <initialDelaySeconds>0</initialDelaySeconds> <failureThreshold>0</failureThreshold> <periodSeconds>0</periodSeconds> <successThreshold>0</successThreshold> </livenessProbe> </org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate> <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate> <name>cmdtools-centos</name> <image>centos:7.6.1810</image> <privileged> false </privileged> <alwaysPullImage> false </alwaysPullImage> <workingDir>/home/jenkins</workingDir> <command>/bin/sh -c</command> <args>cat</args> <ttyEnabled> true </ttyEnabled> <resourceRequestCpu></resourceRequestCpu> <resourceRequestMemory></resourceRequestMemory> <resourceLimitCpu></resourceLimitCpu> <resourceLimitMemory></resourceLimitMemory> <envVars/> <ports/> <livenessProbe> <execArgs></execArgs> <timeoutSeconds>0</timeoutSeconds> <initialDelaySeconds>0</initialDelaySeconds> <failureThreshold>0</failureThreshold> <periodSeconds>0</periodSeconds> <successThreshold>0</successThreshold> </livenessProbe> </org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate> </containers> <envVars/> <annotations/> <imagePullSecrets/> <nodeProperties/> <podRetention class= "org.csanchez.jenkins.plugins.kubernetes.pod.retention.Default" /> </org.csanchez.jenkins.plugins.kubernetes.PodTemplate>

          This error is caused by empty yaml fields but I don't see how it is triggered.
          In any case I added some safeguards in a PR that should fix it
          https://github.com/jenkinsci/kubernetes-plugin/pull/462

          Carlos Sanchez added a comment - This error is caused by empty yaml fields but I don't see how it is triggered. In any case I added some safeguards in a PR that should fix it https://github.com/jenkinsci/kubernetes-plugin/pull/462

          Problem seems to be that the yaml was changed from string to a string list.
          https://github.com/jenkinsci/kubernetes-plugin/commit/c52ebdf5ad3fcd2dd8b53e2b8441d61d0a8693f3#diff-c1e2813295afdbf77e75d9606d614906
          I diffed the pod template sections in config.xml from an affected jenkins instance against a healthy one:

          < <yamls>
          < <string></string>
          < </yamls>

          > <yamls class="empty-list"/>

           Hitting the save button on the jenkins configuration page fixes the problem. Unfortunately that solution doesn't scale well.

          Diego Cousinet added a comment - Problem seems to be that the yaml was changed from string to a string list. https://github.com/jenkinsci/kubernetes-plugin/commit/c52ebdf5ad3fcd2dd8b53e2b8441d61d0a8693f3#diff-c1e2813295afdbf77e75d9606d614906 I diffed the pod template sections in config.xml from an affected jenkins instance against a healthy one: < <yamls> < <string></string> < </yamls> — > <yamls class="empty-list"/>  Hitting the save button on the jenkins configuration page fixes the problem. Unfortunately that solution doesn't scale well.

          Thanks dcousinet that snippet had made me realize what the issue is. It's fixed in https://github.com/jenkinsci/kubernetes-plugin/pull/462

          Carlos Sanchez added a comment - Thanks dcousinet that snippet had made me realize what the issue is. It's fixed in https://github.com/jenkinsci/kubernetes-plugin/pull/462

          Compiled your PR and it fixes the problem for us. Likewise thanks, csanchez!

          Diego Cousinet added a comment - Compiled your PR and it fixes the problem for us. Likewise thanks, csanchez !

          Aðalsteinn Rúnarsson added a comment - - edited

          I have this issue in 1.15.4.

          After updating from 1.14.9 to 1.15.4 pods can't seem to be created, with the 'MismatchedInputException: No content to map due to end-of-input' error message showing up in the logs.

          Rolling back to the previous version 1.14.9 fixes the problem.

          Aðalsteinn Rúnarsson added a comment - - edited I have this issue in 1.15.4. After updating from 1.14.9 to 1.15.4 pods can't seem to be created, with the 'MismatchedInputException: No content to map due to end-of-input' error message showing up in the logs. Rolling back to the previous version 1.14.9 fixes the problem.

          it will be in 1.15.5

          Carlos Sanchez added a comment - it will be in 1.15.5

          Ahh, ok. Thanks!

          Aðalsteinn Rúnarsson added a comment - Ahh, ok. Thanks!

            csanchez Carlos Sanchez
            mreinhardt Martin Reinhardt
            Votes:
            0 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: