[ 
https://issues.apache.org/jira/browse/MNG-7213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17406906#comment-17406906
 ] 

Karl Heinz Marbaise commented on MNG-7213:
------------------------------------------

The other example does not compile with Java 1.8 because the configuration for 
maven-compiler-plugin is missing. 

Apart from that...I'm not very familiar with the resolver code but based on the 
examples like this: 
https://github.com/apache/maven-resolver/blob/master/maven-resolver-demos/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/GetDependencyHierarchy.java

I don't see any call to the repository basic setup (which contains different 
references on class within the example directory):
{code:java}
RepositorySystem system = Booter.newRepositorySystem( Booter.selectFactory( 
args ) );

DefaultRepositorySystemSession session = Booter.newRepositorySystemSession( 
system );
{code}
Furthermore I would suggest to start with the given example as starting point 
....like this one:

https://github.com/apache/maven-resolver/blob/master/maven-resolver-demos/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/ResolveTransitiveDependencies.java

which exactly solves the problem are are trying to solve if I correctly 
understand your code...

BUT 

I've tested to use the given dependency in a usual pom file which results in 
strange results
{code}
[WARNING] The POM for org.webjars.npm:chalk:jar:2.2.2 is missing, no dependency 
information available
[WARNING] The POM for org.webjars.npm:iconv-lite:jar:0.4.21 is missing, no 
dependency information available
[WARNING] The POM for org.webjars.npm:hosted-git-info:jar:2.6.0 is missing, no 
dependency information available
{code}
Furthermore the resolving takes ages ... and simply hangs (meaning it will not 
finish)... I have tested to limit the memory in Maven to 200m and it fails 
{code}
[ERROR] Java heap space: failed reallocation of scalar replaced objects -> 
[Help 1]
java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar 
replaced objects
[ERROR] 
{code}



> StackOverflowError when version ranges are unsolvable and graph contains a 
> cycle
> --------------------------------------------------------------------------------
>
>                 Key: MNG-7213
>                 URL: https://issues.apache.org/jira/browse/MNG-7213
>             Project: Maven
>          Issue Type: Bug
>    Affects Versions: 3.6.3, 3.8.1
>            Reporter: Henrik Rueping
>            Priority: Major
>             Fix For: waiting-for-feedback
>
>         Attachments: babelcoreresolver.zip, babelcoreresolver15.zip
>
>
> I encountered a very similar situation as described in MNG-6737. 
> It happens when I want to find the transitive dependencies of the Artifact
> org.webjars.npm:babel-core:6.0.16
> I tried the Maven-goal dependency:tree on a Maven-Project with only this 
> Artifact in the pom. 
> With Maven 3.6.3 I got a StackOverflowError (with a similar Stacktrace as 
> below. The accept get repeated).
> With Maven 3.8.1 it took considerably longer and ended in an OutOfMemoryError 
> (same Stacktrace).
> The same behaviour happens of course if I want to view the transitive 
> dependencies of my 
> project in Eclipse.
> I also tried to calculate the transitive dependencies in java itself, and I 
> found that the Threads are stuck in a stacktrace of the form:
>  
> {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).
> So maybe it is not even a Bug, and it just happens that 
> org.webjars.npm:babel-core:6.0.16 behaves a bit like a Zip-Bomb for Maven and 
> there is nothing one can do here.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to