bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.16k stars 4.05k forks source link

Bazel crashes fetching http_archive dependency #14682

Closed mambon2 closed 2 years ago

mambon2 commented 2 years ago

Description of the problem / feature request:

Bazel build crashes fetching http_archive rules dependency if its not accessible. What the best way to protect against this?

Feature requests: what underlying problem are you trying to solve with this feature?

Perhaps cache the dependency in bazel cache?

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

This is only reproducible if an http_archive dependency goes away. it happened today intermittently for https://github.com/buchgr/rules_jmh/zipball/6ccf8d7b270083982e5c143935704b9f3f18b256

What operating system are you running Bazel on?

ubuntu 18.04.1

What's the output of bazel info release?

release 4.0.0

Wyverald commented 2 years ago

Can you provide the crash log please?

mambon2 commented 2 years ago

Can you provide the crash log please?

WARNING: Download from https://github.com/buchgr/rules_jmh/zipball/6ccf8d7b270083982e5c143935704b9f3f18b256 failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException Checksum was f88fe443f17ae00bf759f4b5f2614dfc4bfddf9c558c2f3f470ffc51fcf96e85 but wanted dbb7d7e5ec6e932eddd41b910691231ffd7b428dff1ef9a24e4a9a59c1a1762d 11:39:29 ERROR: An error occurred during the fetch of repository 'rules_jmh': 11:39:29 Traceback (most recent call last): 11:39:29 File "/root/.cache/bazel/_bazel_root/fd19306aeb82431c50d8802f6a113c90/external/bazel_tools/tools/build_defs/repo/http.bzl", line 111, column 45, in _http_archive_impl 11:39:29 download_info = ctx.download_and_extract( 11:39:29 Error in download_and_extract: java.io.IOException: Error downloading [https://github.com/buchgr/rules_jmh/zipball/6ccf8d7b270083982e5c143935704b9f3f18b256] to /root/.cache/bazel/_bazel_root/fd19306aeb82431c50d8802f6a113c90/external/rules_jmh/temp969063267732403804/6ccf8d7b270083982e5c143935704b9f3f18b256.zip: Checksum was f88fe443f17ae00bf759f4b5f2614dfc4bfddf9c558c2f3f470ffc51fcf96e85 but wanted dbb7d7e5ec6e932eddd41b910691231ffd7b428dff1ef9a24e4a9a59c1a1762d 11:39:29 ERROR: Error fetching repository: Traceback (most recent call last): 11:39:29 File "/root/.cache/bazel/_bazel_root/fd19306aeb82431c50d8802f6a113c90/external/bazel_tools/tools/build_defs/repo/http.bzl", line 111, column 45, in _http_archive_impl 11:39:29 download_info = ctx.download_and_extract( 11:39:29 Error in download_and_extract: java.io.IOException: Error downloading [https://github.com/buchgr/rules_jmh/zipball/6ccf8d7b270083982e5c143935704b9f3f18b256] to /root/.cache/bazel/_bazel_root/fd19306aeb82431c50d8802f6a113c90/external/rules_jmh/temp969063267732403804/6ccf8d7b270083982e5c143935704b9f3f18b256.zip: Checksum was f88fe443f17ae00bf759f4b5f2614dfc4bfddf9c558c2f3f470ffc51fcf96e85 but wanted dbb7d7e5ec6e932eddd41b910691231ffd7b428dff1ef9a24e4a9a59c1a1762d 11:39:29 INFO: Repository rules_jvm_external instantiated at: 11:39:29 /home/jenkins/agent/workspace/FES_Package_Builder_master/beeswaxio/WORKSPACE:13:11: in 11:39:29 /home/jenkins/agent/workspace/FES_Package_Builder_master/beeswaxio/beeswax/bzl/workspace/rules_deps.bzl:31:17: in rules_deps 11:39:29 Repository rule http_archive defined at: 11:39:29 /root/.cache/bazel/_bazel_root/fd19306aeb82431c50d8802f6a113c90/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in 11:39:29 ERROR: no such package '@rules_jmh//': java.io.IOException: Error downloading [https://github.com/buchgr/rules_jmh/zipball/6ccf8d7b270083982e5c143935704b9f3f18b256] to /root/.cache/bazel/_bazel_root/fd19306aeb82431c50d8802f6a113c90/external/rules_jmh/temp969063267732403804/6ccf8d7b270083982e5c143935704b9f3f18b256.zip: Checksum was f88fe443f17ae00bf759f4b5f2614dfc4bfddf9c558c2f3f470ffc51fcf96e85 but wanted dbb7d7e5ec6e932eddd41b910691231ffd7b428dff1ef9a24e4a9a59c1a1762d 11:39:29 Loading: 0 packages loaded 11:39:29 Loading: 0 packages loaded

mambon2 commented 2 years ago

and this is our rules_dependency

http_archive(
    name = "rules_jmh",
    sha256 = "dbb7d7e5ec6e932eddd41b910691231ffd7b428dff1ef9a24e4a9a59c1a1762d",
    strip_prefix = "buchgr-rules_jmh-6ccf8d7",
    type = "zip",
    url = "https://github.com/buchgr/rules_jmh/zipball/6ccf8d7b270083982e5c143935704b9f3f18b256",
)
Wyverald commented 2 years ago

This is not a crash. It's simply saying there was a checksum mismatch:

11:39:29 Error in download_and_extract: java.io.IOException: Error downloading [https://github.com/buchgr/rules_jmh/zipball/6ccf8d7b270083982e5c143935704b9f3f18b256] to /root/.cache/bazel/_bazel_root/fd19306aeb82431c50d8802f6a113c90/external/rules_jmh/temp969063267732403804/6ccf8d7b270083982e5c143935704b9f3f18b256.zip: Checksum was f88fe443f17ae00bf759f4b5f2614dfc4bfddf9c558c2f3f470ffc51fcf96e85 but wanted dbb7d7e5ec6e932eddd41b910691231ffd7b428dff1ef9a24e4a9a59c1a1762d

See relevant discussion at https://github.com/bazel-contrib/SIG-rules-authors/issues/11#issuecomment-1026769107

mambon2 commented 2 years ago

thank you. I don't see any activity on this project https://github.com/buchgr/rules_jmh so its possible it was not accessible?

Wyverald commented 2 years ago

GitHub had a temporary change today that caused all non-stable archives to have different checksums. The error log you provided indicates that the download was successful, but the checksum was different. (Whether a project is active or not has no bearing on the accessibility of its archives.)

In any case, this isn't a Bazel bug. Please go to e.g. slack.bazel.build to discuss this.

mambon2 commented 2 years ago

My google account does not end with google.com. Can you send me an invite pmunoz@beeswax.com ?

mambon2 commented 2 years ago

I realize its not a bazel bug. I'm asking if bazel provides a way to guard against this? and what makes this a non-stable archive?

Wyverald commented 2 years ago

Bazel cannot guard against this, since you can point http_archive at anything and that thing can become unavailable. According to https://github.com/bazel-contrib/SIG-rules-authors/issues/11#issuecomment-1026865432, archives in releases are stable, while others are potentially not.