Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-17582

Possible resource leaks due to unclosed InputStreams

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 13.0
    • 11.10.5
    • Other
    • Unknown
    • N/A
    • N/A

    Description

      We have many places in platform where we use an InputStream but forget to close it. This can lead to resource leaks (e.g. unreleased file descriptors) and other problems over the lifetime of a running XWiki instance.

      After going through the output of a simple grep (that excludes test):

      grep "getResourceAsStream" . -R --exclude-dir=target* --exclude-dir=test
      

      ...and filtering out the valid usages, I ended up with this relatively complete list of problems in xwiki-platform that need to be addressed and the used InputStreams need to be closed (generally by using try-with-catch in most cases):

      I got the idea to check this after watching this relevant part of this video: https://www.youtube.com/watch?v=c755fFv1Rnk&t=45m10s (even more details on the problem and how the memory grew in that example in the previous minutes).

      Attachments

        Activity

          People

            tmortagne Thomas Mortagne
            enygma Eduard Moraru
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: