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

    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

          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

          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

          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.

          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

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

            Dates

              Created:
              Updated:
              Resolved: