com-lihaoyi / mill

Mill is a fast JVM build tool that supports Java and Scala. 2-3x faster than Gradle and 5-10x faster than Maven for common workflows, Mill aims to make your project’s build process performant, maintainable, and flexible
https://mill-build.org/
MIT License
2.05k stars 337 forks source link

randomly failing dependency downloads. concurrent download #1028

Closed axaluss closed 2 years ago

axaluss commented 3 years ago

I'm seeing randomly failing dependency downloads since upgrade to 0.9.3

.resolvedIvyDeps Failed to load source dependencies
   concurrent download: https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.2.3/jackson-databind-2.2.3.jar

another run

Failed to load source dependencies
   concurrent download: https://repo1.maven.org/maven2/io/netty/netty-all/4.0.23.Final/netty-all-4.0.23.Final.jar

another run

resolvedRunIvyDeps Failed to load source dependencies
   concurrent download: https://repo1.maven.org/maven2/org/apache/kafka/kafka_2.10/0.10.1.0/kafka_2.10-0.10.1.0.jar
   concurrent download: https://repo1.maven.org/maven2/org/rocksdb/rocksdbjni/4.9.0/rocksdbjni-4.9.0.jar

By chance eventually it resolves.

lefou commented 3 years ago

There are some concurrency issues with current coursier. E.g. https://github.com/coursier/coursier/issues/1815#issuecomment-736738585 or https://github.com/coursier/coursier/issues/1818. Question is, if we hit one of the existing or even a new one.

axaluss commented 3 years ago

in my build setup also only scala 2.11 builds were affected. 2.12 was fine

lefou commented 3 years ago

This issue is even more close to ours: https://github.com/coursier/coursier/issues/2022

lefou commented 2 years ago

Unfortunately, this isn't fixed by #1510.

lefou commented 2 years ago

Here is a reproducer:

import mill._, scalalib._

object foo extends Cross[Foo](1.to(20).map(_.toString): _*)
class Foo(nr: String) extends JavaModule {
  def ivyDeps = Agg(ivy"org.slf4j:slf4j-api:1.7.25")
}
$ rm -r ~/.cache/coursier/v1/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/ ; mill -i clean ; mill -i -j 16 -d __.resolvedIvyDeps
No mill version specified.
You should provide a version via '.mill-version' file or --mill-version option.
Using mill version 0.10.1
Compiling /home/lefou/work/opensource/mill/repro-parallel-fetch/build.sc
[1/1] clean 
No mill version specified.
You should provide a version via '.mill-version' file or --mill-version option.
Using mill version 0.10.1
Using explicit system properties: Map()
[#00] [108/120] foo[16].resolvedIvyDeps | Downloading [2/2] artifacts (~40/40 bytes)
13 targets failed
foo[1].resolvedIvyDeps 
Resolution failed for 1 modules:
--------------------------------------------
  org.slf4j:slf4j-api:1.7.25 
        not found: /home/lefou/.ivy2/local/org.slf4j/slf4j-api/1.7.25/ivys/ivy.xml
        concurrent download: https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.pom

foo[2].resolvedIvyDeps 
Resolution failed for 1 modules:
--------------------------------------------
  org.slf4j:slf4j-api:1.7.25 
        not found: /home/lefou/.ivy2/local/org.slf4j/slf4j-api/1.7.25/ivys/ivy.xml
        concurrent download: https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.pom

foo[3].resolvedIvyDeps 
Resolution failed for 1 modules:
--------------------------------------------
  org.slf4j:slf4j-api:1.7.25 
        not found: /home/lefou/.ivy2/local/org.slf4j/slf4j-api/1.7.25/ivys/ivy.xml
        concurrent download: https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.pom
...
alexarchambault commented 2 years ago

🤔

alexarchambault commented 1 month ago

Disabling the retry in CoursierSupport.scala, it seems I can't reproduce that issue anymore on the current main branch (via this repo). Downgrading coursier to 2.1.0-M5 alongside that (version used in Mill 0.10.1, used in the example above) doesn't allow to reproduce the issue either. So it seems changes in Mill since 0.10.1, other than the retry, fixed the issue too.

I can reproduce the issue with Mill 0.10.1 (with both downloaded and locally built assemblies). In Mill 0.10.2, the retry kicks in and works around it. Checking out the Mill 0.10.1 sources and manually bumping coursier to 2.1.10 fixes the issue. So changes in coursier since 2.1.0-M5 also fixed the issue.

lefou commented 1 month ago

There are still some concurrency issues in coursier we caught in Mill and needed to workaround with retry. E.g.

It's probably not worth in digging these old resolved issues though. We should concentrate on fixing open issues.