[ https://issues.apache.org/jira/browse/MNG-6737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17398568#comment-17398568 ]
Henrik Rueping commented on MNG-6737: ------------------------------------- I seem to still run into this problem. It happens when I want to find the transitive Dependencies of the ArtifactI seem to still run into this problem. It happens when I want to find the transitive Dependencies of the Artifact org.webjars.npm:babel-core:6.0.16 (even if I just add it to Eclipse as a dependency, it crushes Eclipse if I want to see the dependency hierarchy).In java itself, I encounter the Stacktrace: {code:java} Thread [main] (Suspended) Stack<E>.get(int) line: 75 AbstractList$Itr.next() line: 358 Stack<E>(AbstractCollection<E>).contains(Object) line: 106 PathRecordingDependencyVisitor.visitEnter(DependencyNode) line: 99 DefaultDependencyNode.accept(DependencyVisitor) line: 343 DefaultDependencyNode.accept(DependencyVisitor) line: 347 (... omitted many Repititions...) DefaultDependencyNode.accept(DependencyVisitor) line: 347 NearestVersionSelector.newFailure(ConflictResolver$ConflictContext) line: 158 NearestVersionSelector.backtrack(NearestVersionSelector$ConflictGroup, ConflictResolver$ConflictContext) line: 120 NearestVersionSelector.selectVersion(ConflictResolver$ConflictContext) line: 93 ConflictResolver.transformGraph(DependencyNode, DependencyGraphTransformationContext) line: 180 ChainedDependencyGraphTransformer.transformGraph(DependencyNode, DependencyGraphTransformationContext) line: 80 DefaultDependencyCollector.collectDependencies(RepositorySystemSession, CollectRequest) line: 273 DefaultRepositorySystem.collectDependencies(RepositorySystemSession, CollectRequest) line: 284 (..ommitted own code...) {code} I used: org.apache.maven:maven-resolver-provider:3.8.1 org.apache.maven.resolver:maven-resolver-util:1.6.2 I used ArtifactDescriptorPolicy.STRICT (maybe this setting makes a difference). > StackOverflowError when version ranges are unsolvable and graph contains a > cycle > -------------------------------------------------------------------------------- > > Key: MNG-6737 > URL: https://issues.apache.org/jira/browse/MNG-6737 > Project: Maven > Issue Type: Bug > Affects Versions: 3.6.1 > Reporter: Tomo Suzuki > Assignee: Michael Osipov > Priority: Major > Fix For: 3.8.2, 4.0.0, 4.0.0-alpha-1 > > > Maven throws StackOverflowError when version ranges are unsolvable and the > dependency graph contains a cycle. > {code:java} > $ mvn install > ... > [INFO] --------------------------< suztomo:module-c > >-------------------------- > [INFO] Building module-c 1.0 > [INFO] --------------------------------[ jar > ]--------------------------------- > [INFO] > ------------------------------------------------------------------------ > [INFO] BUILD FAILURE > [INFO] > ------------------------------------------------------------------------ > [INFO] Total time: 0.406 s > [INFO] Finished at: 2019-08-16T12:10:30-04:00 > [INFO] > ------------------------------------------------------------------------ > ... > Exception in thread "main" java.lang.StackOverflowError > at > org.eclipse.aether.graph.DefaultDependencyNode.accept(DefaultDependencyNode.java:341) > at > org.eclipse.aether.graph.DefaultDependencyNode.accept(DefaultDependencyNode.java:345) > at > org.eclipse.aether.graph.DefaultDependencyNode.accept(DefaultDependencyNode.java:345) > at > org.eclipse.aether.graph.DefaultDependencyNode.accept(DefaultDependencyNode.java:345) > at > org.eclipse.aether.graph.DefaultDependencyNode.accept(DefaultDependencyNode.java:345) > at > org.eclipse.aether.graph.DefaultDependencyNode.accept(DefaultDependencyNode.java:345) > ...(omitting many lines)... > {code} > h1. Example > Example project to reproduce the issue: > [https://github.com/suztomo/maven-cyclic-dependency-with-range] > h1. Diagnosis > In the example above, because of a version conflict on grpc-core (1.21.0 v.s. > 1.16.1), > [org.eclipse.aether.util.graph.transformer.NearestVersionSelector.newFailure|https://github.com/apache/maven-resolver/blob/maven-resolver-1.4.0/maven-resolver-util/src/main/java/org/eclipse/aether/util/graph/transformer/NearestVersionSelector.java#L158] > tries to throw UnsolvableVersionConflictExceptoin. However, before throwing > the exception PathRecordingDependencyVisitor visits nodes in the dependency > graph and the graph contains a cycle. The visitor goes to infinite recursion > in visiting the cyclic path, resulting in StackOverflowError. > > {code:java} > private UnsolvableVersionConflictException newFailure( final ConflictContext > context ) > { > ... > PathRecordingDependencyVisitor visitor = new PathRecordingDependencyVisitor( > filter ); > context.getRoot().accept( visitor ); > return new UnsolvableVersionConflictException( visitor.getPaths() ); > }{code} > > The cycle in the graph consists of module-a and module-b as illustrated below: > {code:java} > module-c:1.0.0 > +- module-b:2.0.0 > +- module-a:1.0.0 > +- module-b:0.0.1 > +- module-b:1.0.0 > | +- module-a:1.0.0 > | +- module-b:0.0.1 > | +- module-b:1.0.0 > ...{code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)