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

File Leak in libraryResource pipeline step

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • Any Jenkins server using v2.10 of the workflow-cps-global-lib plugin
    • workflow-cps-global-lib 2.11

      Recently, we have been seeing our Jenkins instance regularly consume a ton of file descriptors, to the point of maxing out the users limit.

      This growth is quite visible when using the monitoring plugin attached at the bottom.

      We had fairly stable performance up until this point.

      In investigating, the files that were open in large frequencies were almost always files that had been loaded with the libraryResource pipeline step.

      Upon further investigation, I found this recent change: https://github.com/jenkinsci/workflow-cps-global-lib-plugin/commit/e03488893cdeabe4738a443a0bfadd5306c46b73#diff-fd5e052acc6b8e96384fe9ab7850852aL205

      Previously, the implementation used FilePath.readToString() in order to read the file.  This method uses a try-with-resources to read the InputStream, ensuring the input is closed prior to the method exiting.

      The newer implementation has lost this safety, causing a file leak anytime a file is ready with libraryResource.

       

      We had fairly 

            tschaible Tom Schaible
            tschaible Tom Schaible
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: