Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration
  2. CONFIGURATION-687

Memory leak and related issues with CombinedConfigurationBuilder

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.3
    • Component/s: File reloading
    • Labels:
      None

      Description

      In CombinedConfigurationBuilder, each call to resetResult() adds new builders to the list of child builders. Likewise, and likely for the same reason, for ReloadingCombinedConfigurationBuilder, the resetResult() call adds to the list of subcontrollers.

      When resetResult() is called because of an reload update, the next n calls to getReloadingController().checkForReloading() will also initiate reloading,  causing a reset and increasing the number of subcontrollers. So the first change causes 1 reload, the second change causes 2 reloads, and it doubles each time, so the 7th touch leads to 128 reloads!

      Functionally, there are no apparent symptoms until memory exhaustion and/or thrashing occur.

      This seems to be happen because CombinedConfigurationBuilder.initResultInstance rebuilds from the parameters without clearing all of the existing state, particularly sourceData, so SourceData ends up adding the reconstructed builders on top of the existing ones. Correcting this could be as simple as cleaning up and clearing sourceData to force creation of new SourceData.

      Code in attached zip (maven project) demonstrates the issue.

       

        Attachments

        1. ReloadCombinedBug.zip
          5 kB
          Luke Hamaty

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              wlhamaty Luke Hamaty
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: