Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8290316

Ensure that all directory streams are closed in java.base

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 20
    • 17, 20
    • core-libs
    • b08

    Description

      There are a number of places where the internal implementation
      indirectly uses directory streams but neglects to explicitly close them.
      It is recommended to always close directory streams to ensure that any
      resources held for the open directory are freed.

      The usage of directory streams (not closed) is through the following
      calls: Files::list, Files::walk, and Files::find. Specifically a number
      of unclosed calls are in ModulePatcher, ModuleReferences, ModulePath,
      ExplodedImage, and HijrahChronology.

      These unclosed streams may not be all that much of a problem in the
      happy case (where the stream is exhausted), but can certainly, and have
      been noticed, leaking file descriptors in the case where an error occurs
      deep in the directory hierarchy. Either way, it is best practice to
      ensure that they are always closed.

      (note: there are a small number of similar issues in the jlink area, but
      they'll be addressed separately)

      Attachments

        Issue Links

          Activity

            People

              rjernst Ryan Ernst
              chegar Chris Hegarty
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: