bndtools / bnd

Bnd/Bndtools. Tooling to build OSGi bundles including Eclipse, Maven, and Gradle plugins.
https://bndtools.org
Other
526 stars 304 forks source link

Spring Boot 3.3.0 causing StackOverflowError #6147

Open chrislake opened 3 weeks ago

chrislake commented 3 weeks ago

Bndtools : 7.0.0.REL-202310060912-gb82dc86 Java : OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7) OS: Windows 10 (22H2 19045.4046) Git-Descriptor: 7.0.0.RC2-3-gb82dc867a Git-SHA: b82dc867a7920edfcf32cb2cfa408795f4af6aea

We recently attempted to update our Spring Boot project to the latest 3.3.0 version and found that a StackOverflowError was produced attempting to resolve the dependencies. We were able to get this to easily reproducible steps as follows:

  1. Download "Eclipse IDE for Java Developers" and start to create a new workspace
  2. Install "Bndtools m2e" from https://bndtools.jfrog.io/bndtools/update-latest in to Eclipse and restart
  3. Create the simplest maven project from https://start.spring.io/ and import maven project in to Eclipse
  4. StackOverflowError

I was able to get some logging which perhaps pointed to the MavenDependenciesRepository.collect(projectFacade,monitor) -> MavenBndrunContainer.getBndrunContainer(...) forcing the includeDependencyManagement value to true. This is what was found in the .metadata\.plugins\org.eclipse.m2e.logback\0.log log:

[13:01:13,668] DEBUG a.b.m.l.r.DependencyResolver.discoverArtifacts(DependencyResolver.java:304) Located file: .m2\repository\org\springframework\boot\spring-boot-starter-web\3.3.0\spring-boot-starter-web-3.3.0.jar for artifact org.springframework.boot:spring-boot-starter-web:jar:3.3.0 < central (https://repo.maven.apache.org/maven2, default, releases)
[13:01:13,671] DEBUG a.b.m.l.r.DependencyResolver.discoverArtifacts(DependencyResolver.java:304) Located file: .m2\repository\org\springframework\boot\spring-boot-starter\3.3.0\spring-boot-starter-3.3.0.jar for artifact org.springframework.boot:spring-boot-starter:jar:3.3.0 < central (https://repo.maven.apache.org/maven2, default, releases)
[13:01:13,673] DEBUG a.b.m.l.r.DependencyResolver.discoverArtifacts(DependencyResolver.java:304) Located file: .m2\repository\org\springframework\boot\spring-boot\3.3.0\spring-boot-3.3.0.jar for artifact org.springframework.boot:spring-boot:jar:3.3.0 < central (https://repo.maven.apache.org/maven2, default, releases)
...
[13:01:14,904] WARN  o.e.m.c.i.e.EclipseLogger.warn(EclipseLogger.java:64) The POM for org.flywaydb:flyway-commandline:jar:10.10.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[13:01:17,210] WARN  o.e.m.c.i.e.EclipseLogger.warn(EclipseLogger.java:64) The POM for io.zipkin.brave:brave-instrumentation-benchmarks:jar:6.0.3 is missing, no dependency information available
[13:01:19,748] WARN  o.e.m.c.i.e.EclipseLogger.warn(EclipseLogger.java:64) The POM for com.google.android.gms:play-services-tasks:jar:16.0.1 is missing, no dependency information available
...
[13:01:33,278] DEBUG a.b.m.l.r.DependencyResolver.discoverArtifacts(DependencyResolver.java:304) Located file: .m2\repository\io\netty\netty-tcnative-boringssl-static\2.0.65.Final\netty-tcnative-boringssl-static-2.0.65.Final-linux-x86_64.jar for artifact io.netty:netty-tcnative-boringssl-static:jar:linux-x86_64:2.0.65.Final < central (https://repo.maven.apache.org/maven2, default, releases)
[13:01:33,280] DEBUG a.b.m.l.r.DependencyResolver.discoverArtifacts(DependencyResolver.java:304) Located file: .m2\repository\io\netty\netty-tcnative-classes\2.0.65.Final\netty-tcnative-classes-2.0.65.Final.jar for artifact io.netty:netty-tcnative-classes:jar:2.0.65.Final < central (https://repo.maven.apache.org/maven2, default, releases)
[13:01:33,283] DEBUG a.b.m.l.r.DependencyResolver.discoverArtifacts(DependencyResolver.java:304) Located file: .m2\repository\io\netty\netty-tcnative-boringssl-static\2.0.65.Final\netty-tcnative-boringssl-static-2.0.65.Final-linux-x86_64.jar for artifact io.netty:netty-tcnative-boringssl-static:jar:linux-x86_64:2.0.65.Final < central (https://repo.maven.apache.org/maven2, default, releases)
[13:01:33,285] DEBUG a.b.m.l.r.DependencyResolver.discoverArtifacts(DependencyResolver.java:304) Located file: .m2\repository\io\netty\netty-tcnative-classes\2.0.65.Final\netty-tcnative-classes-2.0.65.Final.jar for artifact io.netty:netty-tcnative-classes:jar:2.0.65.Final < central (https://repo.maven.apache.org/maven2, default, releases)
[13:01:33,286] DEBUG a.b.m.l.r.DependencyResolver.discoverArtifacts(DependencyResolver.java:304) Located file: .m2\repository\io\netty\netty-tcnative-boringssl-static\2.0.65.Final\netty-tcnative-boringssl-static-2.0.65.Final-linux-x86_64.jar for artifact io.netty:netty-tcnative-boringssl-static:jar:linux-x86_64:2.0.65.Final < central (https://repo.maven.apache.org/maven2, default, releases)
[13:01:33,288] DEBUG a.b.m.l.r.DependencyResolver.discoverArtifacts(DependencyResolver.java:304) Located file: .m2\repository\io\netty\netty-tcnative-classes\2.0.65.Final\netty-tcnative-classes-2.0.65.Final.jar for artifact io.netty:netty-tcnative-classes:jar:2.0.65.Final < central (https://repo.maven.apache.org/maven2, default, releases)
[13:01:33,290] DEBUG a.b.m.l.r.DependencyResolver.discoverArtifacts(DependencyResolver.java:304) Located file: .m2\repository\io\netty\netty-tcnative-boringssl-static\2.0.65.Final\netty-tcnative-boringssl-static-2.0.65.Final-linux-x86_64.jar for artifact io.netty:netty-tcnative-boringssl-static:jar:linux-x86_64:2.0.65.Final < central (https://repo.maven.apache.org/maven2, default, releases)
[13:01:33,292] DEBUG a.b.m.l.r.DependencyResolver.discoverArtifacts(DependencyResolver.java:304) Located file: .m2\repository\io\netty\netty-tcnative-classes\2.0.65.Final\netty-tcnative-classes-2.0.65.Final.jar for artifact io.netty:netty-tcnative-classes:jar:2.0.65.Final < central (https://repo.maven.apache.org/maven2, default, releases)

It seems that all the usual dependencies are downloaded without issue, then BND goes on to attempt to download all the optional dependencies, before finally it gets stuck attempting to resolve two dependencies and eventually throws the StackOverflowError.

I have tried to modify our POM to exclude the problematic dependencies, however, I only ever succeed in removing the actual dependencies with which there is no problem, I cannot seem to stop BND from attempting to resolve every optional dependency.

I guess the real issue might be with the dependencies themselves, or perhaps how BND goes about determining what should be download. I think though it would be great to have an option to turn off includeDependencyManagement rather than just hard coding it to true.