Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-829

StandardBenchmarker#makeDocument does not explicitly close opened files

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      Patch Available

      Description

      StandardBenchmarker#makeDocument(File in, String[] tags, boolean stored, boolean tokenized, boolean tfv)

      BufferedReader reader = new BufferedReader(new FileReader(in));

      Above reader is not closed until GC hits it. Can cause problems in cases where ulimit is set too low.

      I did this:

      while ((line = reader.readLine()) != null)

      { body.append(line).append(' '); }

      + reader.close();

        Activity

        Hide
        karl.wettin Karl Wettin added a comment -

        This is also true for ReutersDocMaker:

        StringBuffer bodyBuf = new StringBuffer(1024);
        while ((line = reader.readLine()) != null)

        { bodyBuf.append(line).append(' '); }

        + reader.close();

        Show
        karl.wettin Karl Wettin added a comment - This is also true for ReutersDocMaker: StringBuffer bodyBuf = new StringBuffer(1024); while ((line = reader.readLine()) != null) { bodyBuf.append(line).append(' '); } + reader.close();
        Hide
        doronc Doron Cohen added a comment -

        Commited the fix for this.
        There were actually two more cases like this.

        Thanks Karl!

        Show
        doronc Doron Cohen added a comment - Commited the fix for this. There were actually two more cases like this. Thanks Karl!
        Hide
        doronc Doron Cohen added a comment -

        Patch commited already, attaching it here for any future reference purposes.

        Show
        doronc Doron Cohen added a comment - Patch commited already, attaching it here for any future reference purposes.

          People

          • Assignee:
            doronc Doron Cohen
            Reporter:
            karl.wettin Karl Wettin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development