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

Jenkins discard-old-build caused open file handles

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Ubuntu 16.04
      Java 1.8.0_191
      Jenkins 2.138.4

       
      After Jenkins upgraded from 2.46.2 to 2.138.4 on Jan 5. 2019,

      I started to see many (deleted) open file handles.

      Those (deleted) open file handles seem caused by "discard old build" rotate.

      The "builds/.${old-build-number}" folder doesn't exist anymore,

      but when using "lsof" command to check, it showed up:

      sudo lsof -a -p $(pgrep -P $(sudo cat /var/run/jenkins/jenkins.pid)) | grep '(deleted)'

      eg

      java 34189 jenkins 5199r REG 252,0 1818111 17044616 /var/lib/jenkins/jobs/Projects/jobs/FortiClientEMS/jobs/br_6_Branch_Build/builds/.1394/log (deleted)

      java 34189 jenkins 5200r REG 252,0 1813394 17052273 /var/lib/jenkins/jobs/Projects/jobs/FortiClientEMS/jobs/br_6_Branch_Build/builds/.1388/log (deleted)

      java 34189 jenkins 5201r REG 252,0 1813394 17052273 /var/lib/jenkins/jobs/Projects/jobs/FortiClientEMS/jobs/br_6_Branch_Build/builds/.1388/log (deleted)

      java 34189 jenkins 5212r REG 252,0 1815212 17053470 /var/lib/jenkins/jobs/Projects/jobs/FortiClientEMS/jobs/br_6_Branch_Build/builds/.1398/log (deleted)

          [JENKINS-56223] Jenkins discard-old-build caused open file handles

          Kevin Yu added a comment -

          Is there any update on this issue? Our system is having the same problem at the moment.

          Kevin Yu added a comment - Is there any update on this issue? Our system is having the same problem at the moment.

          I finally found the root cause of my issue: A groovy script opens the output of some runs using "run.getLogReader()".
          And the created reader is never closed. Therefore, file handle remains open.

          Hope this can help for other people having the same issue...

           

          Xavier Raynaud added a comment - I finally found the root cause of my issue: A groovy script opens the output of some runs using "run.getLogReader()". And the created reader is never closed. Therefore, file handle remains open. Hope this can help for other people having the same issue...  

            nkns165 nkns165
            totoroliu Rick Liu
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: