[
https://issues.apache.org/jira/browse/SLING-10204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17329102#comment-17329102
]
Eric Norman edited comment on SLING-10204 at 4/22/21, 1:12 PM:
---------------------------------------------------------------
[~stefanegli] Yes, there was definitely broken functionality which is how I
noticed it wasn't working.
It appears to me that the main problem appears to be that
"resourceResolver.close()" is called in the finally block of
OakClusterViewService#getLocalClusterView after populating the "descriptor"
variable and then the same "resourceResolver" variable is used in the next
try/catch block without getting a fresh instance. So the "resourceResolver"
seems to be prematurely closed there. Perhaps you intended to wrap the whole
section with a try/finally and close the resourceResolver at the end of the
block, rather than closing it in the middle (and again at the end)?
was (Author: enorman):
[~stefanegli] Yes, there was definitely broken functionality which is how I
noticed it wasn't working.
It appears to me that the main problem appears to be that
"resourceResolver.close()" is called in the finally block after populating the
"descriptor" variable and then the same "resourceResolver" variable is used in
the next try/catch block without getting a fresh instance. So the
"resourceResolver" seems to be prematurely closed there. Perhaps you intended
to wrap the whole section with a try/finally and close the resourceResolver at
the end of the block, rather than closing it in the middle (and again at the
end)?
> Make OakDiscoveryService.updatedPropertyProvider tolerate deactivated
> repository
> --------------------------------------------------------------------------------
>
> Key: SLING-10204
> URL: https://issues.apache.org/jira/browse/SLING-10204
> Project: Sling
> Issue Type: Task
> Components: Discovery
> Reporter: Stefan Egli
> Assignee: Stefan Egli
> Priority: Minor
> Fix For: Discovery Oak 1.2.32
>
> Time Spent: 1h 50m
> Remaining Estimate: 0h
>
> The following exception has been witnessed during resource resolver factory
> unregistration:
> {noformat}
> 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){noformat}
> 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:
> {noformat}
> 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)
> {noformat}
> {noformat}
> 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)
> {noformat}
> {noformat}
> 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)
> {noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)