Open merks opened 1 year ago
IMavenProjectChangedListener
are dynamic services and thus this is usually not a error (even though eclipse handles it as such).
@jonahgraham
FYI, I opened this for the issue I mentioned in epp-dev.
FYI, I opened this for the issue I mentioned in epp-dev.
So what issue are you seeing as a result of this? If everything is working, m2e can hardly do anything...
I don't know what these services do nor what this failure means. I'm not an expert. I get the impression that it means that some component will not be properly initialized as a result. Perhaps as an expert you are able to determine if this is a bogus diagnosis by the platform or if something really doesn't work. You mention that this is "usually" not an error which seems to cast doubt on whether it is or isn't an error and whether eclipse is handling it poorly versus correctly. It's easy to reproduce the problem via the described steps...
If everything works fine there is mostly no problem, but you can take a look at the OSGi console and type list
that will show you all components, and if they are all satisfied it should be fine:
WARNING: This console is connected to the current running instance of Eclipse!
____________________________
Welcome to Apache Felix Gogo
g! list
... will list all components here...
In DS you define references to services and you declare what services your component offers. These reference can be either static or dynamic.
C1
with a dynamic optional reference to Service A
(that means it can come and go while your component is active and you handle it properly when it is missing) and provide Service B
.C2
that provides Service A
and will be injected to the first component.C2
requires other services and one of those requires Service A
(either direct or indirectly)What happen now is, that DS tries to satisfies as much as possible from C1
(and therefore tries to create C2)
but detects that there is a circular dependency chain and print the warning/error/... as Service A
is optional, now DS creates C1
without it (what works because Service A
is optional), now C2
can be constructed and will be injected into C1
(because it is dynamic).
So in the end, we have everything setup (even the optional one), even though there is one configuration that has a cycle... you can compare this a bit with P2, that if it detects a conflict on install, tries to compute an alternative configuration that can be satisfied in the end (e.g. by leaving out an optional greedy requirement).
A usual example is a list of listeners: Your component can work without notify other components and they can come and go dynamically.
@tjwatson as you are maintainer at Felix SCR: Can we do anything here?
Not sure what you have in mind. AFAICT Felix SCR is following the spec'ed behavior with respect to circular references:
perhaps a potential improvement is if the reference is optional it could log a warning instead. But that is not always going to be clear if the optional reference is a few levels up from the actual circular error detection.
I'm not sure if
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.
indicates that in such a case no error must be logged because actually the component can be activated?!?
indicates that in such a case no error must be logged because actually the component can be activated?!?
A-optional->B->C->D->A
Here we are creating B to satisfy optional reference from A. In doing so we try to activate B->C->D-> then detect the cycle. Here D cannot be activated and I believe an error should be logged. That bubbles up and A can still be satisfied because B is optional.
Here D cannot be activated and I believe an error should be logged.
D cannot be activated right now, but as soon as A is active, B will become injected and everything works. So I think the condition to log an error should be that the chain is a strong cycle with no (intermediate) optional reference.
We probably could avoid logging an error in this case. I'm unsure how much that will complicate the implementation at this point. You are free to open an issue with Felix to discuss there. Contributions welcome.
Download this package:
https://www.eclipse.org/downloads/packages/release/2022-12/r/eclipse-ide-eclipse-committers
Start the IDE. Disable all update sites in Window -> Preferences -> Install/Update -> Available Software Sites and add this site:
https://download.eclipse.org/releases/2023-03/
Run Help -> Check for Updates and install all the available updates. Restart. Open the Error Log view and notice that it contains this error: