aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arnoud Glimmerveen (Jira)" <>
Subject [jira] [Commented] (ARIES-1940) Failure during service export is not properly handled by RemoteServiceAdminCore
Date Sun, 10 Nov 2019 09:11:00 GMT


Arnoud Glimmerveen commented on ARIES-1940:

I thinks I would try to incorporate it in the current cleanup logic.

I noticed a currently unused method in ExportRegistrationImpl called ExportReferenceAlways().
Which returns the ExportReference value, regardless of exception/closure of the ExportRegistration.
It should be possible upon export failure to create a ExportReferenceImpl (with service reference,
but without EndpointDescription (as there is no endpoint created)). The ServiceListener listening
to UNREGISTERING events triggers logic that could use the ExportReferenceAlways() method to
see if the ServiceReference matches and 'close' the failed ExportRegistration.

This approach would have a number of consequences:
* As the ExportReferenceAlways method is not part of the API, there is a need to downcast
to the specific implementation that has the method
** Alternatively you could within RemoteServiceAdminCore always refer to the implementation
class of ExportRegistration and only on the spec API (RSA's external interface) go back to
the API types.
* An ExportReference instance is created also for a failed ExportRegistration. This instance
will not be reachable through the spec API, so I don't think this will be much of an issue

I have opened a PR with this approach.

> Failure during service export is not properly handled by RemoteServiceAdminCore
> -------------------------------------------------------------------------------
>                 Key: ARIES-1940
>                 URL:
>             Project: Aries
>          Issue Type: Bug
>          Components: Remote Service Admin
>    Affects Versions: rsa-1.14.0
>         Environment: Apache Aries 1.14.0
> Apache Felix Framework 6.0.2
>            Reporter: Arnoud Glimmerveen
>            Assignee: Christian Schneider
>            Priority: Major
>             Fix For: rsa-1.15.0
>          Time Spent: 20m
>  Remaining Estimate: 0h
> When a DistributionProvider throws an Exception from the DistributionProvider.exportService()
method, the RemoteServiceAdminCore detects this properly and keeps track of this failure by
creating a ExportRegistration instance that references the thrown Exception.
> The specification mandates that if a service export failed, the ExportRegistration should
provide access to the thrown Exception (which the current implementation does) and that the
ExportReference of the ExportRegistration should throw an IllegalStateException.
> The current implementation of RemoteServiceAdminCore handles this in an inconsistent
> * The ExportRegistration.getExportReference() returns null rather then throwing the IllegalStateException
> * The use of ExportRegistration assumes that there always is an ExportReference instance.
This assumption is wrong in cases that the export failed.
> The latter triggers exceptions such as as the one below; typically triggered by an event
unrelated to the export service failure:
> {noformat}
> java.lang.NullPointerException
>                 at org.apache.aries.rsa.core.RemoteServiceAdminCore.removeServiceExports(
>                 at org.apache.aries.rsa.core.RemoteServiceAdminCore$2.serviceChanged(
>                 at org.apache.felix.framework.EventDispatcher.invokeServiceListenerCallback(
>                 at org.apache.felix.framework.EventDispatcher.fireEventImmediately(
>                 at org.apache.felix.framework.EventDispatcher.fireServiceEvent(
>                 at org.apache.felix.framework.Felix.fireServiceEvent(
>                 at org.apache.felix.framework.Felix.access$000(
>                 at org.apache.felix.framework.Felix$1.serviceChanged(
>                 at org.apache.felix.framework.ServiceRegistry.unregisterService(
>                 at org.apache.felix.framework.ServiceRegistrationImpl.unregister(
>                 ...
> {noformat}

This message was sent by Atlassian Jira

View raw message