title: Getting hudson.remoting.ChannelClosedException error in Jenkins
body: <p>I have an error while running a pipeline in Jenkins using a Kubernetes Cloud server.</p>
  <p>Everything works fine until the moment of the <code>npm install</code> where i get <code>Cannot contact nodejs-rn5f3: hudson.remoting.ChannelClosedException: Channel &quot;hudson.remoting.Channel@3b1e0041:nodejs-rn5f3&quot;: Remote call on nodejs-rn5f3 failed. The channel is closing down or has closed down</code></p>
  <p>How can I fix this error ?</p>
  <p>Here are my logs :</p>
  <pre><code>[Pipeline] Start of Pipeline
  [Pipeline] podTemplate
  [Pipeline] {
  [Pipeline] node
  Still waiting to schedule task
  ‘nodejs-rn5f3’ is offline
  Agent nodejs-rn5f3 is provisioned from template nodejs
  ---
  apiVersion: &quot;v1&quot;
  kind: &quot;Pod&quot;
  metadata:
    labels:
      jenkins: &quot;slave&quot;
      jenkins/label-digest: &quot;XXXXXXXXXXXXXXXXXXXXXXXXXX&quot;
      jenkins/label: &quot;nodejs&quot;
    name: &quot;nodejs-rn5f3&quot;
  spec:
    containers:
    - args:
      - &quot;cat&quot;
      command:
      - &quot;/bin/sh&quot;
      - &quot;-c&quot;
      image: &quot;node:15.5.1-alpine3.10&quot;
      imagePullPolicy: &quot;IfNotPresent&quot;
      name: &quot;node&quot;
      resources:
        limits: {}
        requests: {}
      tty: true
      volumeMounts:
      - mountPath: &quot;/home/jenkins/agent&quot;
        name: &quot;workspace-volume&quot;
        readOnly: false
      workingDir: &quot;/home/jenkins/agent&quot;
    - env:
      - name: &quot;JENKINS_SECRET&quot;
        value: &quot;********&quot;
      - name: &quot;JENKINS_AGENT_NAME&quot;
        value: &quot;nodejs-rn5f3&quot;
      - name: &quot;JENKINS_WEB_SOCKET&quot;
        value: &quot;true&quot;
      - name: &quot;JENKINS_NAME&quot;
        value: &quot;nodejs-rn5f3&quot;
      - name: &quot;JENKINS_AGENT_WORKDIR&quot;
        value: &quot;/home/jenkins/agent&quot;
      - name: &quot;JENKINS_URL&quot;
        value: &quot;http://XX.XX.XX.XX/&quot;
      image: &quot;jenkins/inbound-agent:4.3-4&quot;
      name: &quot;jnlp&quot;
      resources:
        requests:
          cpu: &quot;100m&quot;
          memory: &quot;256Mi&quot;
      volumeMounts:
      - mountPath: &quot;/home/jenkins/agent&quot;
        name: &quot;workspace-volume&quot;
        readOnly: false
    hostNetwork: false
    nodeSelector:
      kubernetes.io/os: &quot;linux&quot;
    restartPolicy: &quot;Never&quot;
    volumes:
    - emptyDir:
        medium: &quot;&quot;
      name: &quot;workspace-volume&quot;
  
  Running on nodejs-rn5f3 in /home/jenkins/agent/workspace/something
  [Pipeline] {
  [Pipeline] stage
  [Pipeline] { (Test)
  [Pipeline] checkout
  Selected Git installation does not exist. Using Default
  [... cloning repository]
  [Pipeline] container
  [Pipeline] {
  [Pipeline] sh
  + ls -la
  total 1240
  drwxr-xr-x    5 node     node          4096 Feb 26 07:33 .
  drwxr-xr-x    4 node     node          4096 Feb 26 07:33 ..
  -rw-r--r--    1 node     node          1689 Feb 26 07:33 package.json
  and some other files and folders
  [Pipeline] sh
  + cat package.json
  {
    [...]
    &quot;dependencies&quot;: {
      [blabla....]
    },
    &quot;devDependencies&quot;: {
      [blabla...]
    }
  }
  [Pipeline] sh
  + npm install
  Cannot contact nodejs-rn5f3: hudson.remoting.ChannelClosedException: Channel &quot;hudson.remoting.Channel@3b1e0041:nodejs-rn5f3&quot;: Remote call on nodejs-rn5f3 failed. The channel is closing down or has closed down
  </code></pre>
  <p>At this stage, here are the logs of the container <code>jnlp</code> in my pod <code>nodejs-rnf5f3</code> :</p>
  <pre><code>INFO: Connected
  Feb 26, 2021 8:05:53 AM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Read side closed
  Feb 26, 2021 8:05:53 AM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Terminated
  Feb 26, 2021 8:05:53 AM jenkins.slaves.restarter.JnlpSlaveRestarterInstaller$FindEffectiveRestarters$1 onReconnect
  INFO: Restarting agent via jenkins.slaves.restarter.UnixSlaveRestarter@1a39588e
  Feb 26, 2021 8:05:55 AM hudson.remoting.jnlp.Main createEngine
  INFO: Setting up agent: nodejs-rnf5f3
  Feb 26, 2021 8:05:55 AM hudson.remoting.jnlp.Main$CuiListener &lt;init&gt;
  INFO: Jenkins agent is running in headless mode.
  Feb 26, 2021 8:05:55 AM hudson.remoting.Engine startEngine
  INFO: Using Remoting version: 4.3
  Feb 26, 2021 8:05:55 AM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
  INFO: Using /home/jenkins/agent/remoting as a remoting work directory
  Feb 26, 2021 8:05:55 AM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
  INFO: Both error and output logs will be printed to /home/jenkins/agent/remoting
  Feb 26, 2021 8:05:55 AM hudson.remoting.jnlp.Main$CuiListener status
  INFO: WebSocket connection open
  Feb 26, 2021 8:05:58 AM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Connected
  .... same as above
  </code></pre>
  <p>I don't know where this error come from. Is this related to the usage of resources ?</p>
  <p>Here are the usage of my containers :</p>
  <pre><code>POD                   NAME             CPU(cores)   MEMORY(bytes)
  jenkins-1-jenkins-0   jenkins-master   61m          674Mi
  nodejs-rnf5f3         jnlp             468m         104Mi
  nodejs-rnf5f3         node             1243m        1284Mi
  </code></pre>
  <p>My cluster is a <code>e2-medium</code> in GKE with 2 nodes.</p>