[ 
https://issues.apache.org/jira/browse/SLING-4497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14358683#comment-14358683
 ] 

Marius Petria commented on SLING-4497:
--------------------------------------

[~cziegeler], wouldn't it be better to actually put a catch Throwable in the 
finalizer thread. That makes it clear the thread should not die, and it is 
better suited for future modifications.

[1] 
https://github.com/apache/sling/blob/e57ebcd430675d39fead9ee39b1fc2ab3378ebc3/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/CommonResourceResolverFactoryImpl.java#L96

> Memory thread might be terminated by already unregistered bundles/services
> --------------------------------------------------------------------------
>
>                 Key: SLING-4497
>                 URL: https://issues.apache.org/jira/browse/SLING-4497
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: Resource Resolver 1.2.0
>            Reporter: Carsten Ziegeler
>            Assignee: Carsten Ziegeler
>             Fix For: Resource Resolver 1.2.2
>
>
> The memory thread in the common resource resolver factory calls close on the 
> resource context which in turn tries to close all providers and the used type 
> resource resolver. 
> If an exception occurs during this, like it might happen on bundle stop (see 
> below), the memory thread dies which in turn might lead to a memory issue.
> java.lang.IllegalStateException: Invalid BundleContext.
>       at 
> org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:511)
>       at 
> org.apache.felix.framework.BundleContextImpl.ungetService(BundleContextImpl.java:475)
>       at 
> org.apache.sling.jcr.resource.internal.helper.jcr.RepositoryHolder.release(RepositoryHolder.java:53)
>       at 
> org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.close(JcrResourceProvider.java:246)
>       at 
> org.apache.sling.resourceresolver.impl.helper.ResourceResolverContext.close(ResourceResolverContext.java:145)
>       at 
> org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl$ResolverWeakReference.close(CommonResourceResolverFactoryImpl.java:403)
>       at 
> org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl$1.run(CommonResourceResolverFactoryImpl.java:94)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to