felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Bosschaert (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (FELIX-5198) Service should not be available while being unregistered
Date Thu, 25 Feb 2016 16:22:18 GMT

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

David Bosschaert updated FELIX-5198:
    Attachment: felix-5198.patch

The ServiceRegistration.unregister() javadoc states:

"The following steps are required to unregister a service:
* The service is removed from the Framework service registry so that it can no longer be obtained.
* A service event of type {{ServiceEvent.UNREGISTERING}} is fired so that bundles using this
service can release their use of the service.
* Once delivery of the service event is complete, the {{ServiceReference}} objects for the
service may no longer be used to get a service object for the service.
* ..."

I guess the question is: can a reference that is obtained before the service is unregistered
be used _during_ the UNREGISTERING event notification to re-obtain the service? 

The attached very small patch will not return the service any more for pre-existing references
when they try to obtain the service during an UNREGISTERING callback and fixes the test failure.
It also passes the R6 CT. 
[~cziegeler], I did modify the test a tiny bit so that the service is unregistered via ServiceRegistration.unregister().

[~rickhall], do you think the attached patch is acceptible? Or will it trigger the issues
you are referring to?

> Service should not be available while being unregistered
> --------------------------------------------------------
>                 Key: FELIX-5198
>                 URL: https://issues.apache.org/jira/browse/FELIX-5198
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: framework-5.4.0
>            Reporter: Carsten Ziegeler
>            Assignee: David Bosschaert
>             Fix For: framework-5.6.0
>         Attachments: felix-5198.patch, felix-5198.patch
> Currently it is possible to get a service while it is  being unregistered - if the service
is get during processing of the unregistering event. This is the order of events:
> a) a service (factory) is unregistered in the framework
> b) the UNREGISTERING event is sent before the service is actually unregistered (this
is as defined in the spec)
> c) the above event is handled synchronously, reactivating dependent components
> d) during this reactivation, some component looks up the service that is unregistered
in a). as this service is still registered and marked as valid, it gets it
> According to ServiceRegistration.unregister the service should not be available anymore
while the events are sent

This message was sent by Atlassian JIRA

View raw message