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

David Jencks commented on FELIX-5315:
-------------------------------------

The existence of RegionConfigurationSupport is entirely to deal with this 
scenario, and some informal testing seems to indicate that it works (at least 
before I broke stuff in 978a710).  If you can think of an actual scenario where 
the current code doesn't work please explain.  Roughly speaking how I think I 
set it up is:
precondition: there's only one config admin api visible anywhere.  DS isn't 
reasonably going to be able to deal with config admin services that implement 
CA from a package inconsistent with the CA interfaces DS sees.
precondition: there is a maximum of 1 config admin service visible to each 
extended bundle.
- each extended bundle opens a ServiceTracker for config admin services.
- When a config admin service shows up in one of these trackers, we find the 
bundle it's registered with and see if it's a config admin implementation we 
already know about.  If not, we add a new RegionConfigurationSupport for it 
(slightly simplified to elide the no-lock implementation). Therefore, there is 
a 1-1 relationship between config admin services that could possibly be 
relevant to an extended bundle and RegionConfigurationSupport instances.
- the RegionConfigurationSupport deals with configuration events from this 
config admin service and distributes them to relevant components that can see 
the associated config admin service.

> Unexpected release of ConfigurationAdmin service in 
> RegionConfigurationSupport 
> -------------------------------------------------------------------------------
>
>                 Key: FELIX-5315
>                 URL: https://issues.apache.org/jira/browse/FELIX-5315
>             Project: Felix
>          Issue Type: Bug
>          Components: Configuration Admin, Declarative Services (SCR)
>    Affects Versions: scr-2.0.4
>            Reporter: James Watkins-Harvey
>            Assignee: David Jencks
>             Fix For: scr-2.0.6
>
>
> In commit 978a710, RegionConfigurationSupport has been modified to obtain the 
> ConfigurationAdmin service through the ConfigurationAdmin's bundle context 
> (in getConfigAdmin(), around line 633). However, services acquired through 
> that method are then released using the impersonated bundle's context (for 
> example in the finally block of configureComponentHolder(ComponentHolder), 
> around line 186, and the finally block of getConfigurationInfo(TargetedPID, 
> TargetedPID, ComponentHolder, BundleContext), around line 465).
> This cause leak of service on the ConfigurationAdmin's bundle context, as 
> well as unexpected early release of services on impersonated bundle contexts, 
> causing an IllegalStateException("Configuration Admin service has been 
> unregistered") being thrown in 
> ConfigurationAdminImpl#getConfigurationManager().



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

Reply via email to