rules_jvm_external icon indicating copy to clipboard operation
rules_jvm_external copied to clipboard

Random timeout error in maven_install()

Open khtee opened this issue 2 years ago • 3 comments

I'm getting random timeout while fetching Maven artifacts in Bazel run. Sometimes it can run successfully within few seconds. I checked my network it is stable with 800Mbps download speed.

ERROR: no such package '@maven//': Error while fetching artifact with coursier: Timed out
INFO: Elapsed time: 1804.531s

Below is my WORKSPACE file

# Maven dependencies
RULES_JVM_EXTERNAL_TAG = "4.5"

RULES_JVM_EXTERNAL_SHA = "b17d7388feb9bfa7f2fa09031b32707df529f26c91ab9e5d909eb1676badd9a6"

http_archive(
    name = "rules_jvm_external",
    sha256 = RULES_JVM_EXTERNAL_SHA,
    strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
    url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
)

load("@rules_jvm_external//:defs.bzl", "maven_install")
load(":maven_artifacts.bzl", "MAVEN_ARTIFACTS", "MAVEN_EXCLUDED_ARTIFACTS")

maven_install(
    artifacts = MAVEN_ARTIFACTS + IO_GRPC_GRPC_JAVA_ARTIFACTS,
    excluded_artifacts = MAVEN_EXCLUDED_ARTIFACTS,
    generate_compat_repositories = True,
    repositories = [
        "https://repo.maven.apache.org/maven2/",
        "https://maven.google.com/",
    ],
    resolve_timeout = 1800,
)

khtee avatar Jan 17 '23 13:01 khtee

How big is the artifact list? You could debug the repository rule and try running the coursier command directly from the command line.

jin avatar Jan 18 '23 03:01 jin

It is around 125 artifacts. Any guide I can refer on how to run coursier command from command line?

khtee avatar Jan 18 '23 03:01 khtee

https://github.com/bazelbuild/rules_jvm_external#verbose--debug-mode should show you the command.

Also, if you can even get it to succeed once, use artifact pinning to lock down the dependencies and switch to use Bazel's downloader.

jin avatar Jan 18 '23 04:01 jin