Too much output from SH executor causes the agent to freeze

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      I have deployed two Jenkins nodes, one master and one agent, both running ubuntu 18.04 LTS.

      Both nodes are running: OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-0ubuntu0.18.04.1-b13)

      The Jenkins master is v2.138.2.

      I'm catting a file containing some terraform output (approximately 30KB) on the agent using the shell executor in a Jenkins pipeline (see below).

      As the job runs, only a section of the file content is displayed in my console log and then the job freezes. In some cases some more lines from the file are displayed after some time. In any case, an error message is thrown:

      Cannot contact jenkins-linux-agent: java.lang.InterruptedException
      Could not connect to jenkins-linux-agent to send interrupt signal to process
       

      The work around that I've found is to rate limit the number of bytes delivered to stdout using the linux utility pv.

       

      pipeline {  
      
        options {
          buildDiscarder(logRotator(numToKeepStr: '10'))
          ansiColor('xterm')
        }
        
        agent {
          node {
            label 'jenkins-linux-agent'
          }
        }
        
        stages {
          stage('Build') {      
            steps {
              script {
                sh 'cat /tmp/output | pv -l -L 100 -q'
              }
            }
          }
        }
      }
      

       

            Assignee:
            Jeff Thompson
            Reporter:
            Simon Aquino
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: