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

Files that cannot be deployed due to a missing handler are not processed again

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • fileinstall-3.7.0, fileinstall-3.7.2
    • None
    • File Install
    • None

    Description

      Context

      I tried to migrate a custom Karaf distribution from 4.2.8 to 4.3.3 (fileinstall version 3.6.4 -> 3.7.0). The distribution contains a blueprint (xml) file that is supposed to be handled by one of Karaf's custom ArtifactListener_s. This kind of deploment works for Karaf 4.2.8 but fails for 4.3.3

      Issue Analysis

      DirectoryWatcher.java#doProcess has a mechanic of retrying deployment for files that could not be matched to a handler on a previous attempt:

      private void doProcess(Set<File> files) throws InterruptedException
          {
              List<ArtifactListener> listeners = fileInstall.getListeners();
              List<Artifact> deleted = new ArrayList<Artifact>();
              List<Artifact> modified = new ArrayList<Artifact>();
              List<Artifact> created = new ArrayList<Artifact>();
      
              // Try to process again files that could not be processed
              synchronized (processingFailures)
              {
                  files.addAll(processingFailures);
                  processingFailures.clear();
              }
      		//...
      	}
      

      It is vital that doProcess is invoked although no changes have been observed in the watched folder. Otherwise, the retry mechanism is not effective at all.

      The workaround for FELIX-6229 (101a360248311817e1ad4645c549ea77773b0481) introduced a regression (in addition to the possible NPE that was fixed in cbf8174b66af21453ae209c590d4bf7f4a36e36b) that prevents doProcess from being invoked in the absence of changes in the watched directory.

      if (files != null && !files.isEmpty()) {
          process(files);
      }
      

      The added guard !files.isEmpty() to process(files) renders the retrying logic ineffective

      Possible fixes

      Revert to old guard

      if (files != null) {
          process(files);
      }
      

      Account for "processingFailures"

      if ((files != null && !files.isEmpty()) || !processingFailures.isEmpty()) {
          process(files);
      }
      

      This should probably be accompanied by some refactoring. If the re-processing of processingFailures was more apparent (e.g., by having a dedicated method for this),

      • it becomes less likely, that the re-processing gets accidentally broken again
      • re-processing could even be decoupled from the scanning interval

      Attachments

        Issue Links

          Activity

            People

              jbonofre Jean-Baptiste Onofré
              Robert Schulte Robert Schulte
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: