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

forceContextQualifier has been broken since Tycho 4.0.5 #3809

Closed
orionll opened this issue May 3, 2024 · 3 comments · Fixed by #4284
Closed

forceContextQualifier has been broken since Tycho 4.0.5 #3809

orionll opened this issue May 3, 2024 · 3 comments · Fixed by #4284

Comments

@orionll
Copy link

orionll commented May 3, 2024

There is an infinite recursion in AbstractTychoMapping.modelHasProperty if Tycho build is called with -DforceContextQualifier.
Steps to reproduce:

  • Clone https://github.com/vogellacompany/tycho-example
  • Run mvn clean verify -DskipTests -DforceContextQualifier=100500
  • The build runs fine because the version of Tycho in the project is 4.0.4
  • Now change the version of Tycho to 4.0.5 (or 4.0.6/4.0.7) in pom.xml and .mvn/extensions.xml
  • Run mvn clean verify -DskipTests -DforceContextQualifier=100500 again
  • The build is running much slower (or fails with OutOfMemoryError)

The bug was introduced in this commit by @laeubi: #3320.

If you run mvn with -X, you will notice many lines like these:

[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\.polyglot.pom.tycho
[DEBUG] Generate aggregator pom for C:\Projects\TreeAge\tycho-example\bundles\pom.tycho
[DEBUG] Adding module com.vogella.logging.config
[DEBUG] Adding module com.vogella.tycho.p2.ui
[DEBUG] Adding module com.vogella.tycho.platform
[DEBUG] Adding module com.vogella.tycho.platform.linux
[DEBUG] Adding module com.vogella.tycho.plugin1
[DEBUG] Adding module com.vogella.tycho.rcp
[DEBUG] Derived parent for path C:\Projects\TreeAge\tycho-example\bundles is groupId: com.vogella.tycho, artifactId: com.vogella.tycho.root, relativePath: ..\pom.xml
[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\com.vogella.logging.config\.polyglot.META-INF
[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\.polyglot.pom.tycho
[DEBUG] Generate aggregator pom for C:\Projects\TreeAge\tycho-example\bundles\pom.tycho
[DEBUG] Adding module com.vogella.logging.config
[DEBUG] Adding module com.vogella.tycho.p2.ui
[DEBUG] Adding module com.vogella.tycho.platform
[DEBUG] Adding module com.vogella.tycho.platform.linux
[DEBUG] Adding module com.vogella.tycho.plugin1
[DEBUG] Adding module com.vogella.tycho.rcp
[DEBUG] Derived parent for path C:\Projects\TreeAge\tycho-example\bundles\com.vogella.logging.config is groupId: com.vogella.tycho, artifactId: bundles, relativePath: ..\.polyglot.pom.tycho
[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\.polyglot.pom.tycho
[DEBUG] Generate aggregator pom for C:\Projects\TreeAge\tycho-example\bundles\pom.tycho
[DEBUG] Adding module com.vogella.logging.config
[DEBUG] Adding module com.vogella.tycho.p2.ui
[DEBUG] Adding module com.vogella.tycho.platform
[DEBUG] Adding module com.vogella.tycho.platform.linux
[DEBUG] Adding module com.vogella.tycho.plugin1
[DEBUG] Adding module com.vogella.tycho.rcp
[DEBUG] Derived parent for path C:\Projects\TreeAge\tycho-example\bundles\com.vogella.logging.config\META-INF\.. is groupId: com.vogella.tycho, artifactId: bundles, relativePath: ..\.polyglot.pom.tycho
[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\.polyglot.pom.tycho
[DEBUG] Generate aggregator pom for C:\Projects\TreeAge\tycho-example\bundles\pom.tycho
[DEBUG] Adding module com.vogella.logging.config
[DEBUG] Adding module com.vogella.tycho.p2.ui
[DEBUG] Adding module com.vogella.tycho.platform
[DEBUG] Adding module com.vogella.tycho.platform.linux
[DEBUG] Adding module com.vogella.tycho.plugin1
[DEBUG] Adding module com.vogella.tycho.rcp
[DEBUG] Derived parent for path C:\Projects\TreeAge\tycho-example\bundles\com.vogella.logging.config\META-INF\..\.polyglot.pom.tycho\.. is groupId: com.vogella.tycho, artifactId: bundles, relativePath: ..\.polyglot.pom.tycho
[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\.polyglot.pom.tycho
[DEBUG] Generate aggregator pom for C:\Projects\TreeAge\tycho-example\bundles\pom.tycho
[DEBUG] Adding module com.vogella.logging.config
[DEBUG] Adding module com.vogella.tycho.p2.ui
[DEBUG] Adding module com.vogella.tycho.platform
[DEBUG] Adding module com.vogella.tycho.platform.linux
[DEBUG] Adding module com.vogella.tycho.plugin1
[DEBUG] Adding module com.vogella.tycho.rcp
[DEBUG] Derived parent for path C:\Projects\TreeAge\tycho-example\bundles\com.vogella.logging.config\META-INF\..\.polyglot.pom.tycho\..\.polyglot.pom.tycho\.. is groupId: com.vogella.tycho, artifactId: bundles, relativePath: ..\.polyglot.pom.tycho
[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\.polyglot.pom.tycho
[DEBUG] Generate aggregator pom for C:\Projects\TreeAge\tycho-example\bundles\pom.tycho
[DEBUG] Adding module com.vogella.logging.config
[DEBUG] Adding module com.vogella.tycho.p2.ui
[DEBUG] Adding module com.vogella.tycho.platform
[DEBUG] Adding module com.vogella.tycho.platform.linux
[DEBUG] Adding module com.vogella.tycho.plugin1
[DEBUG] Adding module com.vogella.tycho.rcp
[DEBUG] Derived parent for path C:\Projects\TreeAge\tycho-example\bundles\com.vogella.logging.config\META-INF\..\.polyglot.pom.tycho\..\.polyglot.pom.tycho\..\.polyglot.pom.tycho\.. is groupId: com.vogella.tycho, artifactId: bundles, relativePath: ..\.polyglot.pom.tycho
[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\.polyglot.pom.tycho
[DEBUG] Generate aggregator pom for C:\Projects\TreeAge\tycho-example\bundles\pom.tycho
[DEBUG] Adding module com.vogella.logging.config
[DEBUG] Adding module com.vogella.tycho.p2.ui
[DEBUG] Adding module com.vogella.tycho.platform
[DEBUG] Adding module com.vogella.tycho.platform.linux
[DEBUG] Adding module com.vogella.tycho.plugin1
[DEBUG] Adding module com.vogella.tycho.rcp
[DEBUG] Derived parent for path C:\Projects\TreeAge\tycho-example\bundles\com.vogella.logging.config\META-INF\..\.polyglot.pom.tycho\..\.polyglot.pom.tycho\..\.polyglot.pom.tycho\..\.polyglot.pom.tycho\.. is groupId: com.vogella.tycho, artifactId: bundles, relativePath: ..\.polyglot.pom.tycho
[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\.polyglot.pom.tycho
...
@Bananeweizen
Copy link
Contributor

I cannot reproduce. The example builds fine for me with all versions from 4.0.5 to 5.0.0-SNAPSHOT using your command line. Windows 10, Java 21.

That being said, I'm not sure whether the mentioned commit is the one to blame. Given that we see a recursion from a relative path pointing to itself again and again, this might also be related to 5782054, where the file and path handling was refactored. You may want to experiment locally with reverting parts of that, or with adding some more "toRealPath()" calls to avoid the repeated relative paths.

@orionll
Copy link
Author

orionll commented Sep 18, 2024

@Bananeweizen Yes, the build may finish, but that doesn't mean there is no bug. If you run the build with -X, you will see thousands of repetitive paths (..\.polyglot.pom.tycho\..\.polyglot.pom.tycho\..\.polyglot.pom.tycho\..\.polyglot.pom.tycho\...) in the output.

This is a blocker issue for us. We are currently stuck with Tycho 4.0.4 and can't upgrade to later versions. But we need to upgrade because Tycho 4.0.4 only supports Java versions up to 20 and we want to switch Java 17 to Java 21.

Bananeweizen added a commit to Bananeweizen/tycho that referenced this issue Sep 18, 2024
* Normalize path before using it as key in a cache lookup (to avoid
/foo/../a to be different than /a)
* stop recursion if parent model is identical to child model

fixes eclipse-tycho#3809
@laeubi laeubi closed this as completed in 7c0afd6 Sep 18, 2024
eclipse-tycho-bot pushed a commit that referenced this issue Sep 18, 2024
* Normalize path before using it as key in a cache lookup (to avoid
/foo/../a to be different than /a)
* stop recursion if parent model is identical to child model

fixes #3809

(cherry picked from commit 7c0afd6)
eclipse-tycho-bot pushed a commit that referenced this issue Sep 18, 2024
* Normalize path before using it as key in a cache lookup (to avoid
/foo/../a to be different than /a)
* stop recursion if parent model is identical to child model

fixes #3809

(cherry picked from commit 7c0afd6)
@orionll
Copy link
Author

orionll commented Sep 19, 2024

@Bananeweizen, thank you for such a quick fix!

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 a pull request may close this issue.

2 participants