Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-6515

File install race condition leads to empty config files

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • fileinstall-3.7.4
    • fileinstall-3.7.5
    • File Install
    • None

    Description

      We discovered an ugly race condition within Felix Fileinstall together with the Config Admin.

      ConfigInstaller opens the existing config file in a new writer, basically emptying out the file on disk (https://github.com/apache/felix-dev/blob/master/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java#L285) - If at the same time file install reads the file during it's regular poll interval, it will read an empty file. That leads to a new config admin "update" event where the config is empty. Now the first update finishes writing the config to disk and then the second event gets processed in the ConfigInstaller, which then detects all keys need to be removed.

      This then leads to configs which are empty besides the first comment header in the existing file (because only keys afterwards are emptied).

      We have a patch ready which we are currently testing internally which writes to a temp file and do a rename afterwards + skipping to write fully empty configs (that part might not make sense in the official version, but for us, we're never going to "empty" out config files through code, instead we would delete the whole file...). That seems to solve the issue for us, yet still a bit hacky.

      Attachments

        Issue Links

          Activity

            People

              jbonofre Jean-Baptiste Onofré
              svogt Sascha Vogt
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: