You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Christoph Gritschenberger (JIRA)" <ji...@apache.org> on 2012/07/16 18:53:34 UTC

[jira] [Updated] (ARIES-875) ReferenceRecipe may "unget" a service without ever "getting" it

     [ https://issues.apache.org/jira/browse/ARIES-875?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christoph Gritschenberger updated ARIES-875:
--------------------------------------------

    Attachment: my.playground.bundle-0.1.0-SNAPSHOT.jar
                playground-bundle.zip

Source and compiled jar for the demo-bundle.
Just deploy it in a Karaf-3.0.0-SNAPSHOT.
(It works correctly in karaf-2.2.5)
                
> ReferenceRecipe may "unget" a service without ever "getting" it
> ---------------------------------------------------------------
>
>                 Key: ARIES-875
>                 URL: https://issues.apache.org/jira/browse/ARIES-875
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>         Environment: karaf-3.0.0-SNAPSHOT, Aries-1.0.0-SNAPSHOT
>            Reporter: Christoph Gritschenberger
>         Attachments: my.playground.bundle-0.1.0-SNAPSHOT.jar, playground-bundle.zip
>
>
> I discovered this when trying to use the "ConfigurationAdmin"-service in both blueprint and a BundleActivator. Normally this should work but I get this Exception 
> {code}
> java.lang.NullPointerException
> 	at org.apache.felix.cm.impl.ConfigurationAdminImpl.getConfiguration(ConfigurationAdminImpl.java:105)
> 	at my.playground.bundle.Activator$ConfigThread.run(Activator.java:29)
> {code}
> This is because this ConfigurationAdminImpl has been "disposed" after blueprint called "ungetService" in ReferenceRecipe#unbind().
> Normally this should go like this:
> activator gets ConfigAdmin-service
> blueprint gets ConfigAdmin-service
> blueprint ungets ConfigAdmin-service (reference-counter still > 0, so it is not destroyed)
> activator ungets ConfigAdmin-service (reference-counter is now 0, so the dispose-method in the ConfigAdmin is called).
> But what happens is this:
> activator gets ConfigAdmin-service
> blueprint ungets ConfigAdmin-service (reference-counter is now 0, so the dispose-method in the ConfigAdmin is called).
> activator throws NPE because the ConfigAdmin-service has been destroyed.
> The Problem is that calling ReferenceRecipe#unbind() always *ungets* the service, but ReferenceRecipe#bind() does not *get* the service. Thus the *unget*-operation invalidates the service-reference for some other thread.
> I attached a small demo-bundle to show the behaviour. Deploying it in a karaf-3.0.0-SNAPSHOT should show the NPE on the console.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira