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

David Jencks resolved FELIX-4417.
---------------------------------
       Resolution: Invalid
    Fix Version/s: scr-2.0.4

I looked into this more and AFAICT everything is actually working fine. 
Victor's test seems to pass if I insert a delay().  The spec doesn't require us 
to make _any_ of the optional dependencies in a cycle.  The current 
implementation tries to bind the dependencies on a separate thread, which means 
you might have to wait for them to appear.  The problem with trying to satisfy 
them on the invoking thread is that you run into the service registry circular 
reference tracking.  The problem with trying to satisfy them on another thread 
but wait for completion before returning is that the initial getService call 
into the service registry blocks all other threads until it returns.  So, after 
a couple of days reminding myself of why I adopted this solution originally, I 
again think this is the best we can do.  In r1744827 I improved the circular 
reference tracking and logging, so now at least it should be very clear what 
the circular reference is.

> Circular references detected but not resolved if one of the references in the 
> cycle has optional cardinality
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-4417
>                 URL: https://issues.apache.org/jira/browse/FELIX-4417
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.8.2
>            Reporter: Victor Antonovich
>            Assignee: David Jencks
>             Fix For: scr-2.0.4
>
>         Attachments: CircularReferenceTest-trunk.patch, 
> CircularReferenceTest.zip
>
>
> Looks like current Apache Felix SCR implementation doesn't conform fully to 
> Declarative Services Specification, which says 
> (http://www.osgi.org/download/r4v43/osgi.cmpn-4.3.0.pdf, 112.3.7):
> "Circular references must be detected by SCR when it attempts to satisfy 
> component configurations and SCR must fail to satisfy the references involved 
> in the cycle and log an error message with the Log Service, if present. 
> However, if one of the references in the cycle has optional cardinality SCR 
> must break the cycle. The reference with the optional cardinality can be 
> satisfied and bound to zero target services. Therefore the cycle is broken 
> and the other references may be satisfied."
> In case of two components, A and B, where A is delayed with 1..1 static 
> reference to B, and B is immediate with 0..n dynamic reference to A, Felix 
> SCR should:
> 1) activate B with dynamic reference to A satisfied and bound to zero services
> 2) activate A with satisfied static reference to B
> 3) bind dynamic reference to B in component A
> But it seems current Felix SCR implementation can't handle this kind of 
> circular dependency correctly and is failing with message "Circular reference 
> detected".



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

Reply via email to