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

parseLog() in NaginatorListener.java does not close its BufferedReader or FileReader, leaking OS resources

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Hello!

      I was taking a look at how regex was handled in this plugin, and ran across this:

      https://github.com/jenkinsci/naginator-plugin/blob/master/src/main/java/com/chikli/hudson/plugin/naginator/NaginatorListener.java#L144-L161

      It looks like the plugin never actually calls close on either reader. This will leak file handles and potentially system/OS buffers for each build log (and build logs can get huge).

      This method should close the outside wrapper / buffered reader.

        Attachments

          Activity

          Hide
          martinb3 Martin Smith added a comment -

          Submitted a PR to the project to add a try/finally block.

          https://github.com/jenkinsci/naginator-plugin/pull/12

          Show
          martinb3 Martin Smith added a comment - Submitted a PR to the project to add a try/finally block. https://github.com/jenkinsci/naginator-plugin/pull/12
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Martin Smith
          Path:
          src/main/java/com/chikli/hudson/plugin/naginator/NaginatorListener.java
          http://jenkins-ci.org/commit/naginator-plugin/51e8a7a59c2bf69557891c2b7813c1f9973d5208
          Log:
          [FIXED JENKINS-25800] Ensure BufferedReader in parseLog is closed

          Added a try/finally block around the reader, so it doesn't leak resources. BufferedReader will automatically call close on the FileReader it wraps.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Martin Smith Path: src/main/java/com/chikli/hudson/plugin/naginator/NaginatorListener.java http://jenkins-ci.org/commit/naginator-plugin/51e8a7a59c2bf69557891c2b7813c1f9973d5208 Log: [FIXED JENKINS-25800] Ensure BufferedReader in parseLog is closed Added a try/finally block around the reader, so it doesn't leak resources. BufferedReader will automatically call close on the FileReader it wraps.

            People

            • Assignee:
              ndeloof Nicolas De Loof
              Reporter:
              martinb3 Martin Smith
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: