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

OOME from LineTransformationOutputStream processing CR-delimited output

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core

      A CloudBees CI user reported an OutOfMemoryError on a particular controller. Examination of the heap dump revealed multiple byte arrays in the 1Gb range containing text from running builds; much of the text was of the form of thousands of lines like

      Checking out files:  25% (2345/34567)
      

      terminated by CR (ASCII 13). These seem to have been caused by a Windows agent cloning a gigantic Git repository; I was able to confirm in Windows 10 that

      node('windows') {
          bat 'dir'
          deleteDir()
          bat 'git clone https://github.com/jenkinsci/jenkins'
      }
      

      does produce a bunch of lines of this type. In a real terminal the CR would cause the progress bar to update live on a single line. While the manual page for git-clone says that --progress is implied only when Git is connected to a terminal, and that works as claimed on Linux, I suppose this code does not work in Windows, and you actually need to pass -q.

      Currently LineTransformationOutputStream does not treat CR specially (except for purposes of trimEOL) and so it buffers all of the output until the command completes. While the lack of live progress messages is at most an annoyance, if the output is large it can lead to heap exhaustion.

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: