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

Make OakDiscoveryService.updatedPropertyProvider tolerate deactivated repository

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • Discovery Oak 1.2.34
    • Discovery
    • None

    Description

      The following exception has been witnessed during resource resolver factory unregistration:

      java.lang.IllegalArgumentException: Can't create child on a synthetic root
              at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.create(ResourceResolverImpl.java:979) [org.apache.sling.resourceresolver:1.7.2]
      ...
              at org.apache.sling.api.resource.ResourceUtil.getOrCreateResource(ResourceUtil.java:571) [org.apache.sling.api:2.22.0]
              at org.apache.sling.discovery.commons.providers.util.ResourceHelper.getOrCreateResource(ResourceHelper.java:45) [org.apache.sling.discovery.commons:1.0.20]
              at org.apache.sling.discovery.oak.OakDiscoveryService.doUpdateProperties(OakDiscoveryService.java:492) [org.apache.sling.discovery.oak:1.2.30]
              at org.apache.sling.discovery.oak.OakDiscoveryService.bindPropertyProviderInteral(OakDiscoveryService.java:406) [org.apache.sling.discovery.oak:1.2.30]
              at org.apache.sling.discovery.oak.OakDiscoveryService.updatedPropertyProvider(OakDiscoveryService.java:421) [org.apache.sling.discovery.oak:1.2.30]
      	at jdk.internal.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)

      Under normal circumstances osgi should not invoke any of the updatedPropertyProvider/unbindPropertyProvider methods after the resourceResolverFactory is deactivated - but it has been seen nevertheless.

      What can be done in OakDiscoveryService is to tolerate this and not issue a log.warn instead of throwing an uncaught IllegalArgumentException.

      Edit: more cases with the same root cause:

      java.lang.Exception: Could not adapt resourceResolver to session: org.apache.sling.resourceresolver.impl.ResourceResolverImpl@3e685b17
      	at org.apache.sling.discovery.commons.providers.spi.base.DiscoveryLiteDescriptor.getDescriptorFrom(DiscoveryLiteDescriptor.java:54) [org.apache.sling.discovery.commons:1.0.20]
      	at org.apache.sling.discovery.oak.cluster.OakClusterViewService.getLocalClusterView(OakClusterViewService.java:113) [org.apache.sling.discovery.oak:1.2.30]
      	at org.apache.sling.discovery.base.commons.BaseDiscoveryService.getTopology(BaseDiscoveryService.java:77) [org.apache.sling.discovery.base:2.0.8]
      	at org.apache.sling.discovery.oak.OakDiscoveryService.checkForTopologyChange(OakDiscoveryService.java:660) [org.apache.sling.discovery.oak:1.2.30]
      	at org.apache.sling.discovery.oak.pinger.OakViewChecker.discoveryLiteCheck(OakViewChecker.java:217) [org.apache.sling.discovery.oak:1.2.30]
      	at org.apache.sling.discovery.oak.pinger.OakViewChecker.access$000(OakViewChecker.java:62) [org.apache.sling.discovery.oak:1.2.30]
      	at org.apache.sling.discovery.oak.pinger.OakViewChecker$1.run(OakViewChecker.java:193) [org.apache.sling.discovery.oak:1.2.30]
      	at org.apache.sling.discovery.base.commons.PeriodicBackgroundJob.safelyRun(PeriodicBackgroundJob.java:86) [org.apache.sling.discovery.base:2.0.8]
      	at org.apache.sling.discovery.base.commons.PeriodicBackgroundJob.run(PeriodicBackgroundJob.java:77) [org.apache.sling.discovery.base:2.0.8]
      	at java.base/java.lang.Thread.run(Thread.java:834)
      
      java.lang.Exception: Could not adapt resourceResolver to session: org.apache.sling.resourceresolver.impl.ResourceResolverImpl@215bf7ef
      	at org.apache.sling.discovery.commons.providers.spi.base.DiscoveryLiteDescriptor.getDescriptorFrom(DiscoveryLiteDescriptor.java:54) [org.apache.sling.discovery.commons:1.0.20]
      	at org.apache.sling.discovery.oak.TopologyWebConsolePlugin.updateDiscoveryLiteHistory(TopologyWebConsolePlugin.java:778) [org.apache.sling.discovery.oak:1.2.30]
      	at org.apache.sling.discovery.oak.TopologyWebConsolePlugin.handleTopologyEvent(TopologyWebConsolePlugin.java:728) [org.apache.sling.discovery.oak:1.2.30]
      	at org.apache.sling.discovery.commons.providers.base.AsyncTopologyEvent.trigger(AsyncTopologyEvent.java:53) [org.apache.sling.discovery.commons:1.0.20]
      	at org.apache.sling.discovery.commons.providers.base.AsyncEventSender.run(AsyncEventSender.java:118) [org.apache.sling.discovery.commons:1.0.20]
      	at java.base/java.lang.Thread.run(Thread.java:834)
      
      java.lang.Exception: Could not adapt resourceResolver to session: org.apache.sling.resourceresolver.impl.ResourceResolverImpl@4686b1bf
      	at org.apache.sling.discovery.commons.providers.spi.base.DiscoveryLiteDescriptor.getDescriptorFrom(DiscoveryLiteDescriptor.java:54) [org.apache.sling.discovery.commons:1.0.20]
      	at org.apache.sling.discovery.oak.cluster.OakClusterViewService.getLocalClusterView(OakClusterViewService.java:113) [org.apache.sling.discovery.oak:1.2.30]
      	at org.apache.sling.discovery.base.commons.BaseDiscoveryService.getTopology(BaseDiscoveryService.java:77) [org.apache.sling.discovery.base:2.0.8]
      	at org.apache.sling.discovery.oak.OakDiscoveryService.checkForTopologyChange(OakDiscoveryService.java:660) [org.apache.sling.discovery.oak:1.2.30]
      	at org.apache.sling.discovery.oak.pinger.OakViewChecker.discoveryLiteCheck(OakViewChecker.java:217) [org.apache.sling.discovery.oak:1.2.30]
      	at org.apache.sling.discovery.oak.pinger.OakViewChecker.access$000(OakViewChecker.java:62) [org.apache.sling.discovery.oak:1.2.30]
      	at org.apache.sling.discovery.oak.pinger.OakViewChecker$1.run(OakViewChecker.java:193) [org.apache.sling.discovery.oak:1.2.30]
      	at org.apache.sling.discovery.base.commons.PeriodicBackgroundJob.safelyRun(PeriodicBackgroundJob.java:86) [org.apache.sling.discovery.base:2.0.8]
      	at org.apache.sling.discovery.base.commons.PeriodicBackgroundJob.run(PeriodicBackgroundJob.java:77) [org.apache.sling.discovery.base:2.0.8]
      	at java.base/java.lang.Thread.run(Thread.java:834)
      

      Attachments

        1. SLING-10204-2.git.patch
          1 kB
          Stefan Egli

        Issue Links

          Activity

            People

              stefanegli Stefan Egli
              stefanegli Stefan Egli
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2.5h
                  2.5h