Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-161

FileCleaningTrackerTestCase hangs

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 2.0
    • Component/s: Utilities
    • Labels:
      None
    • Environment:

      Description

      The following code in FileCleaningTrackerTestCase never exits, hanging the whole compilation/testing process:

      private void waitUntilTrackCount() {
      while (theInstance.getTrackCount() != 0) {
      int total = 0;
      while (theInstance.getTrackCount() != 0)

      { byte[] b = new byte[1024 * 1024]; b[0] = (byte) System.currentTimeMillis(); total = total + b[0]; System.gc(); }

      }
      }

      It is clear that in theory this code might loop forever, as the allocation of the byte arrays might never unleash a garbage collection complete enough to deallocate all marker objects, so to bring the track count to zero. Believe me, it's not only theory .

        Attachments

          Activity

            People

            • Assignee:
              niallp Niall Pemberton
              Reporter:
              vigna Sebastiano Vigna
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: