Repository navigation
Milestone
Description
The project has a large number of dependencies, but for some reasons, showMvnDepsTree started to hang without ever returning. I'm pretty sure it used to work before.
> head -n50 stacktrace.txt
2026-02-12 16:04:08
Full thread dump OpenJDK 64-Bit Server VM (21.0.9+10-LTS mixed mode, sharing):
Threads class SMR info:
_java_thread_list=0x00007f8e00001c20, length=41, elements={
0x00007f8ea40302c0, 0x00007f8ea414ac90, 0x00007f8ea414c200, 0x00007f8ea414d980,
0x00007f8ea414efc0, 0x00007f8ea4150560, 0x00007f8ea4152120, 0x00007f8ea41537e0,
0x00007f8ea41602d0, 0x00007f8ea4163520, 0x00007f8ea4876610, 0x00007f8ea49bdc90,
0x00007f8ea49be810, 0x00007f8ea4a43c30, 0x00007f8ea4a4d710, 0x00007f8ea4b02d90,
0x00007f8ea4b05880, 0x00007f8ea526d9d0, 0x00007f8ea526e9c0, 0x00007f8ea5219ff0,
0x00007f8ea52415b0, 0x00007f8ea52426c0, 0x00007f8ea5273a10, 0x00007f8ea5274870,
0x00007f8ea52758f0, 0x00007f8d581af1d0, 0x00007f8d5415ab40, 0x00007f8d3c02a2b0,
0x00007f8d4000a1b0, 0x00007f8d34001c70, 0x00007f8d38001e50, 0x00007f8ea57ba990,
0x00007f8d6c021320, 0x00007f8d5c050460, 0x00007f8ea4fcf230, 0x00007f8d44061810,
0x00007f8d14005f10, 0x00007f8d20001910, 0x00007f8d1c00f750, 0x00007f8d501ca470,
0x00007f8e00000fc0
}
"main" #1 [25984] prio=5 os_prio=0 cpu=14791,10ms elapsed=25,45s tid=0x00007f8ea40302c0 nid=25984 runnable [0x00007f8eaa08a000]
java.lang.Thread.State: RUNNABLE
at scala.collection.IterableOnceOps.exists(IterableOnce.scala:661)
at scala.collection.IterableOnceOps.exists$(IterableOnce.scala:337)
at scala.collection.AbstractIterable.exists(Iterable.scala:946)
at coursier.core.DependencySet.containsModule(DependencySet.scala:134)
at coursier.graph.DependencyTree$Node$$anonfun$1.applyOrElse(DependencyTree.scala:162)
at coursier.graph.DependencyTree$Node$$anonfun$1.applyOrElse(DependencyTree.scala:161)
at scala.collection.immutable.List.collect(List.scala:269)
at scala.collection.immutable.List.collect(List.scala:254)
at coursier.graph.DependencyTree$Node.children(DependencyTree.scala:161)
at coursier.util.Print$.$anonfun$dependencyTree0$11(Print.scala:235)
at coursier.util.Print$$$Lambda/0x00007f8e24aabdb0.apply(Unknown Source)
at coursier.util.Tree.$anonfun$customRender$3(Tree.scala:49)
at coursier.util.Tree.$anonfun$customRender$3$adapted(Tree.scala:43)
at coursier.util.Tree$$Lambda/0x00007f8e24aad320.apply(Unknown Source)
at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:633)
at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:337)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1328)
at coursier.util.Tree.recursivePrint$1(Tree.scala:43)
at coursier.util.Tree.$anonfun$customRender$3(Tree.scala:49)
at coursier.util.Tree.$anonfun$customRender$3$adapted(Tree.scala:43)
at coursier.util.Tree$$Lambda/0x00007f8e24aad320.apply(Unknown Source)
at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:633)
at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:337)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1328)
at coursier.util.Tree.recursivePrint$1(Tree.scala:43)
at coursier.util.Tree.$anonfun$customRender$3(Tree.scala:49)
at coursier.util.Tree.$anonfun$customRender$3$adapted(Tree.scala:43)
at coursier.util.Tree$$Lambda/0x00007f8e24aad320.apply(Unknown Source)
at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:633)
at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:337)
Activity
lihaoyi commentedon Feb 12, 2026
@alexarchambault could you help look at this one? It seems like a non-linear performance issue inside the Coursier tree renderer
lefou commentedon Feb 13, 2026
This is really a showstopper. I need to fix some real-world classpath issues and can't analyze it properly. The strange thing is, that
--whatDependsOnseems to work for some dependencies, that are not highly depended on, but not for others, that are used by more artifacts. I suspect the issue is in the printer/renderer, not the dependency tree itself. Resolution still works, but I can't figure out, why a specific jar is on the classpath.lefou commentedon Feb 13, 2026
Maybe unrelated, but I also saw this:
lolgab commentedon Feb 13, 2026
I'm experiencing hangs in Github Actions when running
resolvedMvnDeps.Example: https://github.com/lolgab/snunit/actions/runs/21903075218/job/63238539156
lihaoyi commentedon Feb 14, 2026
I saw a hang in
resolvedMvnDepshere as well https://github.com/com-lihaoyi/upickle/actions/runs/22011285102/job/63605569178alexarchambault commentedon Feb 20, 2026
About
showMvnDepsTree, the problem might be specific to Mill. On my machine, it takes half a second for the coursier CLI to print the tree of spark-sql, while it takes more than 2 minutes to do the same from Mill:lefou commentedon Feb 21, 2026
I confirm, that
csitself is able to show to full tree. I need to publish my project locally, to be able to inspect it, though.So, at least we have a workaround. Thanks!
But generating the inverse tree with
-Ttook 5m 47s.lefou commentedon Feb 22, 2026
Fix slowness in `showMvnDepsTree` (#6863)
nguyenyou commentedon Feb 28, 2026
This is likely the same root cause as coursier/coursier#3561 — exponential
hashCode()computation on treeNodecase classes that carry graph-wide maps.Both stack traces converge on
Tree.customRender→recursivePrint, which uses aSet[Node]for cycle detection. Eachancestors.contains(elem)andancestors + elemcall triggershashCode()onNode, which recursively hashes large shared data structures (the entire dependency graph). For ~600+ dependencies this becomes O(B^D × N) and never finishes.The fix proposed in coursier/coursier#3561 is to override
hashCode/equalson theNodecase classes to only use identity fields (module, version constraint) instead of the shared graph maps.lefou commentedon Mar 1, 2026
The same project returns all kind of dependencies trees via
iyvDepsTreereally fast with Mill 0.12.17, which is on coursier 2.1.25-M13.lefou commentedon Apr 15, 2026
This is my blocker
#1to migrate from Mill 0.12.17 to Mill 1.1.5.stephenamar-db commentedon May 1, 2026
We are seeing this issue regularly in git hub actions
https://github.com/databricks/sjsonnet/actions/runs/25163113242/job/73762333934?pr=767
18 remaining items
lefou commentedon Aug 11, 2026
Looks like this is not yet solved. This is with Mill 1.1.8:
lefou commentedon Aug 26, 2026
to clarify, this issue had two issues reported:
showMvnDepsTree(without--reverse)showMvnDepsTree --reverseorshowMvnDepsTree --whatDependsOnThe second issue is fixed, but the first and initially reported issue is not fixed.
@alexarchambault said, that this is likely related to Mill and its use of the coursier API, since the tree can be redered when the coursier cli tool
csis used directly, which I confirmed.That being said, we still need to fix the issue. And the Mill implementation that is mapping the Mill module hierarchy to cousier projects internally was contributed by @alexarchambault, so I'd really appreciate your help.
Since the project is not open source, I'll try to provide a reproducer. My hope is, that it might reproduce by just using the Mill files without any sources.
lefou commentedon Aug 27, 2026
Added a reproduction for this issue: https://github.com/lefou/repro-mill-showMvnDepsTree-issue-6823
Reproduction
Checkout the repo.
Run
showMvnDepsTreeand notice, it never returns.Instead, we would expect to see a tree of all transitive dependencies as output.
Debugging
When started as shown above, you can attach to the JVM running class
mill.daemon.MillNoDaemonMainwith the Debugger or Profiler of your choice.Thread dump
A typical thead dump reveals that the process is spending its time in
coursier.core.DependencySet.$anonfun$containsModule$1(DependencySet.scala:134)or nested.Workaround (to see the desired tree)
First install the project itself into the local ivy repository.
Now run coursier
cstool to show the dependency treeDeduplicate the non-inverted dependency tree to fix `showMvnDepsTree`…
lefou commentedon Sep 9, 2026
showMvnDepsTreehanging #7548lefou commentedon Sep 9, 2026
FYI, here is some more info in case you didn't read the PR itself.
In difference to cs/coursier CLI tool, Mill is enabling Gradle metadata when resolving dependencies for Kotlin, Android or Groovy modules. These metadata can provide global overrides which in combination with BOM imports may result in a lot of extra dependency paths, esp. for Kotlin modules. So, while Mill now fixes the issue by deduplicating the tree, the issue is still present in coursier when the coursier-provided tree renderer is used.
Deduplicate the non-inverted dependency tree to fix `showMvnDepsTree`…
Deduplicate reverse dependency tree to fix OOM errors in coursier (ba…
Deduplicate the non-inverted dependency tree to fix `showMvnDepsTree`…