tycho icon indicating copy to clipboard operation
tycho copied to clipboard

forceContextQualifier has been broken since Tycho 4.0.5

Open orionll opened this issue 1 year ago • 1 comments

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
...

orionll avatar May 03 '24 15:05 orionll

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 5782054dec37208b544c7220fe09785e3c7d65ca, 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.

Bananeweizen avatar Jun 02 '24 09:06 Bananeweizen

@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.

orionll avatar Sep 18 '24 10:09 orionll

@Bananeweizen, thank you for such a quick fix!

orionll avatar Sep 19 '24 09:09 orionll