Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: 1052 Adding integration test for Mirror can't find product bundle dependencies. #1085

Closed
wants to merge 3 commits into from

Conversation

fipro78
Copy link
Contributor

@fipro78 fipro78 commented Jun 28, 2022

No description provided.

@github-actions

This comment was marked as outdated.

@laeubi laeubi force-pushed the issue_1052_reproducer branch from dfca2f3 to 65b426c Compare August 10, 2022 04:56
@github-actions
Copy link

github-actions bot commented Aug 10, 2022

Test Results

  582 files  +3    582 suites  +3   4h 1m 43s ⏱️ + 36m 28s
  385 tests +1    375 ✅  - 2   7 💤 ±0  2 ❌ +2  1 🔥 +1 
1 155 runs  +3  1 128 ✅  - 2  22 💤 ±0  2 ❌ +2  3 🔥 +3 

For more details on these failures and errors, see this check.

Results for commit 6a3e4ac. ± Comparison against base commit 6b9cefe.

♻️ This comment has been updated with latest results.

@laeubi laeubi force-pushed the issue_1052_reproducer branch from 65b426c to 43363bd Compare September 7, 2022 13:35
@laeubi
Copy link
Member

laeubi commented Sep 14, 2022

@fipro78 can you try to minimize the testcase as indicated in the bug report? I think a smaller test-case can help us to identify the root cause more quickly.

@fipro78
Copy link
Contributor Author

fipro78 commented Sep 14, 2022

@laeubi well I can try to if I remember what I have done back then. But IIRC you also asked for a testcase about plugin based products. Shouldn't then there be plugins that are integrated? IIUC you want me to drop everything else but the product and the target right?

@laeubi
Copy link
Member

laeubi commented Sep 14, 2022

Yes I think you can drop all the reactor projects (beside target+product of course), and even reduce the product to only contain the org.osgi.service.jaxrs bundle as a reproducer. Then one even can reduce the target further (smaller target = faster execution times) so we get the smallest possible reproducing test-case :-)

This should then make debugging a lot easier as we have only a handful of bundles in the debug in contrast to now a few hundreds.

@fipro78
Copy link
Contributor Author

fipro78 commented Sep 14, 2022

I removed everything and tried to build the project alone locally, but it fails with this error:

[WARNING] The POM for org.eclipse.tycho:tycho-build:jar:3.0.0-SNAPSHOT is missing, no dependency information available
[WARNING] Failed to read extensions descriptor C:\Development\Sources\tycho\tycho-its\projects\product.pluginBased.mavenArtefacts\.mvn\extensions.xml: Plugin org.eclipse.tycho:tycho-build:3.0.0-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact org.eclipse.tycho:tycho-build:jar:3.0.0-SNAPSHOT
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Child module C:\Development\Sources\tycho\tycho-its\projects\product.pluginBased.mavenArtefacts\tycho-its-project.issue1052.target\pom.xml of C:\Development\Sources\tycho\tycho-its\projects\product.pluginBased.mavenArtefacts\pom.xml does not exist @
[ERROR] Child module C:\Development\Sources\tycho\tycho-its\projects\product.pluginBased.mavenArtefacts\tycho-its-project.issue1052.jaxrs.product\pom.xml of C:\Development\Sources\tycho\tycho-its\projects\product.pluginBased.mavenArtefacts\pom.xml does not exist @
[ERROR] Unresolveable build extension: Plugin org.eclipse.tycho:tycho-maven-plugin:3.0.0-SNAPSHOT or one of its dependencies could not be resolved: Failed to collect dependencies at org.eclipse.tycho:tycho-maven-plugin:jar:3.0.0-SNAPSHOT -> org.eclipse.tycho:tycho-core:jar:3.0.0-SNAPSHOT -> org.eclipse.platform:org.eclipse.core.runtime:jar:3.25.0 -> org.eclipse.platform:org.eclipse.equinox.preferences:jar:[3.10.0,4.0.0) @

No idea what is wrong. The pom.xml contains the plugins-repository and I trigger the build via

mvn -Dtycho-version=3.0.0-SNAPSHOT clean verify

Any ideas?

@laeubi
Copy link
Member

laeubi commented Sep 14, 2022

Are you using maven 3.8.6?

@laeubi
Copy link
Member

laeubi commented Sep 14, 2022

Sorry for confusion, I think this is because the snapshot repository needs to be configured in the settings.xml

https://github.com/eclipse-tycho/tycho/wiki#configure-snapshots-repository-globally

@fipro78
Copy link
Contributor Author

fipro78 commented Sep 14, 2022

@laeubi
I have updated the test case. It shows several errors related to some signing topics, but at the end it fails with the reported error.

Copy link
Member

@laeubi laeubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good now!

@laeubi laeubi force-pushed the issue_1052_reproducer branch from 2b52c19 to 5ba7575 Compare September 22, 2022 16:25
@laeubi laeubi changed the title Bug: 1052 Adding integration test Bug: 1052 Adding integration test for Mirror can't find product bundle dependencies. Sep 25, 2022
@laeubi
Copy link
Member

laeubi commented Sep 25, 2022

@fipro78 I have now debugged this and the problem is that there are Projector warnings that prevent a solution here:

Status WARNING: org.eclipse.equinox.p2.director code=0 Unable to satisfy dependency from org.osgi.service.jaxrs 1.0.1.202109301733 to java.package; javax.ws.rs.client 0.0.0.
Status WARNING: org.eclipse.equinox.p2.director code=0 Unable to satisfy dependency from org.osgi.service.jaxrs 1.0.1.202109301733 to java.package; javax.ws.rs.core 0.0.0.
Status WARNING: org.eclipse.equinox.p2.director code=0 Unable to satisfy dependency from org.osgi.service.jaxrs 1.0.1.202109301733 to java.package; javax.ws.rs.sse 0.0.0.
Status WARNING: org.eclipse.equinox.p2.director code=0 Unable to satisfy dependency from org.osgi.service.jaxrs 1.0.1.202109301733 to java.package; org.osgi.dto [1.0.0,2.0.0).
Status WARNING: org.eclipse.equinox.p2.director code=0 Unable to satisfy dependency from org.osgi.service.jaxrs 1.0.1.202109301733 to java.package; org.osgi.framework.dto [1.8.0,2.0.0).
Status WARNING: org.eclipse.equinox.p2.director code=0 Unable to satisfy dependency from org.osgi.service.jaxrs 1.0.1.202109301733 to osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0)).

This then leads to the situation (as all requirements of a product are considered "non greedy" and optional) that the final result of the target only contains [a.jre.javase 17.0.0, tycho-its-project.issue1052.jaxrs.product 1.0.0.qualifier] what of course is not enough. It then (later on) fails to publish the content to the repository that is more later used to perform the mirror operation.

<?pde version="3.8"?>
<target name="tycho-its-project.issue1052.target">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This location can be removed.

@laeubi
Copy link
Member

laeubi commented Sep 25, 2022

@fipro78 can you tell if you would have expsected that the reported requirements are already fulfilled? If yes by what bundle(s) from the target platform?

@fipro78
Copy link
Contributor Author

fipro78 commented Sep 25, 2022

@laeubi
Well initially the product was working. The target and the product contained everything that was needed and it was possible to start the product via PDE inside Eclipse. You then asked me to drop everything to make the example simpler for debugging. So I really can't tell as with this modification the example got broken. Probably I removed to much.

@laeubi
Copy link
Member

laeubi commented Sep 25, 2022

What I suspect here is that the product would actually works, but P2 actually has a problem here because it can't understand some of the requirements. At least the actual error seems misleading here.

@fipro78
Copy link
Contributor Author

fipro78 commented Sep 25, 2022

IIRC the initial product configuration did not show theses warnings, e.g. org.osgi.dto is available if Equinox is included. And I think I also added the necessary xml libraries. I would need to restore the initial setting to see. IMHO the error you see now is different than the initial one.

@laeubi
Copy link
Member

laeubi commented Sep 25, 2022

IIRC the initial product configuration did not show theses warnings,

Well that is because until now these warnings are never printed ;-)

I added some output with this PR:

@laeubi
Copy link
Member

laeubi commented Sep 25, 2022

By the way that are the units that are part of the current target platform:
tycho-its-project.issue1052.jaxrs.product 1.0.0.qualifier
osgi.annotation.source 8.0.1.202109301733
org.osgi.namespace.service.source 1.0.0.201505202024
org.osgi.util.promise.source 1.1.1.201810101357
org.osgi.namespace.implementation.source 1.0.0.201505202024
osgi.annotation 8.0.1.202109301733
org.osgi.service.jaxrs 1.0.1.202109301733
org.osgi.service.jaxrs.source 1.0.1.202109301733
org.osgi.util.promise 1.1.1.201810101357
org.osgi.namespace.service 1.0.0.201505202024
org.osgi.util.function 1.1.0.201802012106
org.osgi.util.function.source 1.1.0.201802012106
org.osgi.namespace.implementation 1.0.0.201505202024
a.jre.javase 17.0.0

@fipro78
Copy link
Contributor Author

fipro78 commented Sep 25, 2022

The initial target definition contained all necessary dependencies. You can see this in the first commit. While the service api and impl bundles are not necessary for the test, it seems the rest is necessary to show the real error. That said, the initial commit should have been only reduced by removing the api and impl, not the rest.

@laeubi
Copy link
Member

laeubi commented Sep 25, 2022

it seems the rest is necessary to show the real error. That said, the initial commit should have been only reduced by removing the api and impl, not the rest.

I then get the following warnings from the projector:

Unable to satisfy dependency from org.apache.aries.jax.rs.whiteboard 1.0.1 to osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0)).
Unable to satisfy dependency from org.apache.aries.jax.rs.whiteboard 1.0.1 to osgi.contract; (&(osgi.contract=JavaAnnotation)(version=1.3.0)).
Unable to satisfy dependency from org.osgi.service.jaxrs 1.0.0.201802012106 to osgi.contract; (&(osgi.contract=JavaJAXRS)(version=2.1.0)).
Unable to satisfy dependency from slf4j.api 1.7.2 to java.package; org.slf4j.impl 1.6.0.

The list of resolved units is:

org.osgi.service.jaxrs 1.0.0.201802012106
jakarta.xml.bind-api 2.3.3
jakarta.annotation-api 1.3.5
org.apache.felix.gogo.runtime 1.1.4.v20210111-1007
org.apache.servicemix.specs.annotation-api-1.3 1.3.0.1
org.osgi.util.promise 1.1.0.201802012106
com.sun.activation.javax.activation 1.2.0
org.eclipse.equinox.executable_root.win32.win32.x86_64 3.8.1700.v20220509-0833
org.eclipse.pde.ds.lib 1.1.500.v20210209-1250
org.slf4j.api 1.7.30.v20200204-2150
javax.annotation 1.3.5.v20200909-1856
org.eclipse.equinox.executable.feature.jar 3.8.1700.v20220509-0833
org.eclipse.osgi 3.18.0.v20220516-2155
a.jre.javase 17.0.0
org.eclipse.equinox.http.servlet 1.7.200.v20211021-1418
org.osgi.util.function 1.1.0.201802012106
org.osgi.util.function 1.2.0.202109301733
org.osgi.service.http.whiteboard 1.0.0.201505202024
slf4j.api 1.7.2
org.eclipse.equinox.launcher.win32.win32.x86_64 1.2.500.v20220509-0833
org.eclipse.osgi.services 3.10.200.v20210723-0643
org.apache.servicemix.specs.jaxws-api-2.2 2.9.0
org.eclipse.equinox.launcher 1.6.400.v20210924-0641
org.apache.felix.gogo.command 1.1.2.v20210111-1007
org.apache.felix.scr 2.1.24.v20200924-1939
org.osgi.util.promise 1.2.0.202109301733
org.apache.felix.gogo.shell 1.1.4.v20210111-1007
org.eclipse.equinox.executable.feature.group 3.8.1700.v20220509-0833
org.apache.aries.jax.rs.whiteboard 1.0.1
org.eclipse.equinox.console 1.4.500.v20211021-1418
org.eclipse.equinox.supplement 1.10.500.v20220516-2155
jakarta.servlet-api 4.0.0
tycho-its-project.issue1052.jaxrs.product 1.0.0.qualifier
org.apache.felix.http.servlet-api 1.1.2
org.apache.aries.javax.jax.rs-api 1.0.1
org.apache.servicemix.specs.saaj-api-1.3 2.9.0
tycho-its-project.issue1052.impl 1.0.0.202209251633
org.apache.felix.http.jetty 4.1.14
tycho-its-project.issue1052.api 1.0.0.202209251633

@fipro78
Copy link
Contributor Author

fipro78 commented Sep 25, 2022

I would think that the contracts should be resolved via

org.apache.aries.javax.jax.rs-api
org.apache.servicemix.specs.annotation-api

I wonder why the annotation api is resolved via three different jars. Also SLF4J api is available twice. The resolution error does not make sense to me.

@laeubi
Copy link
Member

laeubi commented Sep 25, 2022

@merks are you aware of any problems regarding P2 and osgi.contract handling?

@laeubi
Copy link
Member

laeubi commented Sep 25, 2022

I would think that the contracts should be resolved via

org.apache.aries.javax.jax.rs-api org.apache.servicemix.specs.annotation-api

If I look at this I see

Provide-Capability: osgi.contract;osgi.contract=JavaJAXRS;uses:="javax
 .ws.rs,javax.ws.rs.client,javax.ws.rs.container,javax.ws.rs.core,java
 x.ws.rs.ext,javax.ws.rs.sse";version:List<Version>="2.1,2,1.1"

as there is a version LIST @HannesWell I remember you have investigated some missing support in P2 regarding list support?

Could it be:

@HannesWell
Copy link
Member

I would think that the contracts should be resolved via
org.apache.aries.javax.jax.rs-api org.apache.servicemix.specs.annotation-api

If I look at this I see

Provide-Capability: osgi.contract;osgi.contract=JavaJAXRS;uses:="javax
 .ws.rs,javax.ws.rs.client,ja

as there is a version **LIST** @HannesWell I remember you have investigated some missing support in P2 regarding list support?

Could it be:

* [Fix creation of generic-capabilities with multiple versions eclipse-equinox/p2#64](https://github.com/eclipse-equinox/p2/pull/64) ?

Yes that's right and it could definitivly be connected.
But a question that I asked myself a few times already but never answered is, does Tycho/P2 even consider Require-/Provide-Capability Headers in general?

@laeubi
Copy link
Member

laeubi commented Sep 26, 2022

But a question that I asked myself a few times already but never answered is, does Tycho/P2 even consider Require-/Provide-Capability Headers in general?

Obviously it does or we wont see this error here, but maybe I don't fully understand the question?

@merks
Copy link
Contributor

merks commented Sep 26, 2022

Here's a simple way to see what the p2 publisher does. Using `platform:/resource/ in the Repository Explorer shows the p2 published results of all workspace projects. Turning on Expert mode lists all the IUs. You can filter to find one and you can double click the version to see the serialized-to-XML p2 metadata of the IU.

image

There should be nothing special about how osgi.contract is handled...

@laeubi laeubi force-pushed the issue_1052_reproducer branch from 5ba7575 to f18764a Compare December 12, 2022 15:38
@laeubi
Copy link
Member

laeubi commented Dec 13, 2022

@fipro78 Tycho is updated to new eclipse release so with some small adjustments this should finally work now!

@laeubi laeubi force-pushed the issue_1052_reproducer branch from 23c2b07 to 3788a65 Compare January 25, 2023 15:59
@laeubi laeubi force-pushed the issue_1052_reproducer branch from 3788a65 to e20e3d5 Compare March 26, 2023 14:52
@laeubi laeubi force-pushed the issue_1052_reproducer branch from e20e3d5 to adc26fb Compare May 18, 2023 04:31
@laeubi laeubi force-pushed the issue_1052_reproducer branch from adc26fb to 7aea981 Compare July 20, 2023 05:34
@laeubi laeubi force-pushed the issue_1052_reproducer branch from 7aea981 to 82afece Compare December 26, 2023 06:33
@akurtakov akurtakov force-pushed the issue_1052_reproducer branch from 82afece to aa7898f Compare January 6, 2024 07:29
@laeubi
Copy link
Member

laeubi commented Jan 19, 2024

@fipro78 I know this is a very long outstanding issue so sorry for the delay, but I think the root cause might be this here:

lets see if it not breaks anything and after the merge I hope this will be finally resolved. If not I'm a bit out of clue as it seems no one else is really using plugin based products or facing the issue ...

@laeubi laeubi force-pushed the issue_1052_reproducer branch from aa7898f to 6a3e4ac Compare January 20, 2024 05:07
@laeubi
Copy link
Member

laeubi commented Jan 20, 2024

@fipro78 I now have analyzed the problem and actually it works, but the failure we see here is introduced by some mismatch between maven metadata and OSGi metadata:

  1. https://mvnrepository.com/artifact/org.osgi/org.osgi.service.jaxrs/1.0.1 declares the org.apache.aries.javax.jax.rs-api as a provided dependency, that means it is not included in the target.
  2. but org.osgi.service.jaxrs require package javax.ws.rs.client
  3. If one adds this, dependency it reveals that org.apache.aries.javax.jax.rs-api does not declare any maven dependencies but it requires package javax.xml.bind.annotation
  4. If one now adds for example https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api/2.3.1 and what requires https://mvnrepository.com/artifact/javax.activation/javax.activation-api/1.2.0 then the build passes.

Another issue is that Tycho does not fail when resolve the product, that's a bit strange....

laeubi added a commit to laeubi/tycho that referenced this pull request Jan 20, 2024
@laeubi
Copy link
Member

laeubi commented Jan 20, 2024

I now replicated the behavior with two minimal test cases:

this shows:

  1. feature based product fails to resolve with the error that package javax.ws.rs.client is missing (what is correct)
  2. plugin based product does not fail to resolve (whats wrong)

both test cases have a a requirement to the org.osgi.service.jaxrs bundle that requires package javax.ws.rs.client.

@laeubi
Copy link
Member

laeubi commented Jan 20, 2024

@fipro78 unless the bug in Tycho is fixed, you must watch out for messages like this:

[INFO] Resolving dependencies of MavenProject: ....
[WARNING] Problems resolving provisioning plan.:
   Unable to satisfy dependency from org.osgi.service.jaxrs 1.0.1.202109301733 to java.package; javax.ws.rs.client 0.0.0.
   Unable to satisfy dependency from org.osgi.service.jaxrs 1.0.1.202109301733 to java.package; javax.ws.rs.core 0.0.0.
   Unable to satisfy dependency from org.osgi.service.jaxrs 1.0.1.202109301733 to java.package; javax.ws.rs.sse 0.0.0.

these will give you the hints what is missing and needs to be added to the target for your project to package the product. If sou still see issues with none of these warnings please let us know so I can reopen this PR as further work will be performed in #3393.

@laeubi laeubi closed this Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants