Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-11754

Race condition in OsgiInstaller

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Installer Packages Factory 1.0.4, Installer Core 3.12.0
    • None
    • Installer
    • None

    Description

      OsgiInstallerImpl is using SortingServiceTracker to schedule a retry of the OSGi installer run when new service of type ResourceTransformer is added. During the OSGi installer run, the list of available ResourceTransformer services is loaded to transform resources.  

      It might happen that the list of available ResourceTransformer services will be loaded during transforming resources before the new ResourceTransformer which triggered the OSGi installer run will be available in the SortingServiceTracker instance, because the scheduleRetry call is done in SortingServiceTracker.addingService not when the service is already available in SortingServiceTracker but during the preparation of the service instance (the instance returned from SortingServiceTracker.addingService is later added to services list in SortingServiceTracker).

      So in other words, there is a race condition between adding a new service instance to SortingServiceTracker services list and OSGi installer run which perform getting the instances of ResourceTransformer services from the SortingServiceTracker.

      In the result activation of ResourceTransformer might trigger the OSGi installer run but the service will not be found during the run.

      Example issue caused by this:

      If such a last OSGi installer run would be caused by activation of PackageTransformer the untransformed content packages (for example added by OSGI feature model during the first start of the instance) stays untransformed.

      In our pipelines for PRs validation this is happening very often.

      Attachments

        Activity

          People

            Unassigned Unassigned
            pboguski Pawe�� Boguski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: