-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Downloads can be truncated and report an incorrect sha256sum #12010
Comments
Seems like we just hit this on Bazel CI: https://buildkite.com/bazel/bazel-bazel/builds/14172#d7d32a9c-47f3-4d71-87cb-d2ccd872b831
@b0ri5 Do you remember if your log looked the same? |
I found the log thanks to your hint "search internally for the hash"! 🕵️ That looks like the same issue. Bumping this to P1 - we should log a better error and be smarter when the download unexpectedly fails (retry?). |
We've started to hit this massively today for https://dl.google.com/go/go1.16.5.linux-amd64.tar.gz. |
Our logs look like this (with a random SHA each time, since it's not completing the download): (18:13:15) INFO: Repository go_sdk instantiated at:
--
| /build/WORKSPACE:128:23: in <toplevel>
| /root/.cache/bazel/_bazel_root/7b7747ec045ae606eb720a1222f56098/external/io_bazel_rules_go/go/private/sdk.bzl:453:28: in go_register_toolchains
| /root/.cache/bazel/_bazel_root/7b7747ec045ae606eb720a1222f56098/external/io_bazel_rules_go/go/private/sdk.bzl:129:21: in go_download_sdk
| Repository rule _go_download_sdk defined at:
| /root/.cache/bazel/_bazel_root/7b7747ec045ae606eb720a1222f56098/external/io_bazel_rules_go/go/private/sdk.bzl:116:35: in <toplevel>
| (18:13:15) WARNING: Download from https://dl.google.com/go/go1.16.5.linux-amd64.tar.gz failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException Checksum was aac827b456921bd38dfd02279464a1603be465b4512cea30d6cb669e026a2564 but wanted b12c23023b68de22f74c0524f10b753e7b08b1504cb7e417eccebdd3fae49061
| (18:13:15) ERROR: An error occurred during the fetch of repository 'go_sdk':
| Traceback (most recent call last):
| File "/root/.cache/bazel/_bazel_root/7b7747ec045ae606eb720a1222f56098/external/io_bazel_rules_go/go/private/sdk.bzl", line 100, column 16, in _go_download_sdk_impl
| _remote_sdk(ctx, [url.format(filename) for url in ctx.attr.urls], ctx.attr.strip_prefix, sha256)
| File "/root/.cache/bazel/_bazel_root/7b7747ec045ae606eb720a1222f56098/external/io_bazel_rules_go/go/private/sdk.bzl", line 189, column 21, in _remote_sdk
| ctx.download(
| Error in download: java.io.IOException: Error downloading [https://dl.google.com/go/go1.16.5.linux-amd64.tar.gz] to /root/.cache/bazel/_bazel_root/7b7747ec045ae606eb720a1222f56098/external/go_sdk/go_sdk.tar.gz: Checksum was aac827b456921bd38dfd02279464a1603be465b4512cea30d6cb669e026a2564 but wanted b12c23023b68de22f74c0524f10b753e7b08b1504cb7e417eccebdd3fae49061 |
What's the retry logic in this case? Seems like for us that is often good enough |
Hmm, but it's not retrying for us (@keith meant that if we retry the build it will usually work). |
Did you hit the same error for other links as well or just this specific one? |
Also zulu11:
Of note: both are google hosted. |
It's hard to reproduce locally but I can confirm the retry logic is enabled for those links. Not sure why retry didn't work. What do you think if we retry the entire download when content-length is not fulfilled at DownloadManager? (instead of reconnecting to where we left off, we use a fresh connection) |
This has gotten really bad for us, many times an hour. I'm up for whatever might allow these to not fail a build. I'm wondering if |
The linked PR will retry ContentLength mismatch error. Let's see whether it helps. |
Please reopen if that flag doesn't help. |
Will this be back-ported to the 4.x branch? |
Description of the problem / feature request:
A CircleCI (continuous integration service) build seems to have downloaded a truncated version of the file https://dl.google.com/go/go1.15.linux-amd64.tar.gz and thought the download was complete, computed the sha256sum and reported that it was different than what was expected, which is the published version currently at https://golang.org/dl/.
Expected sha256sum: 2d75848ac606061efe52a8068d0e647b35ce487a15bb52272c427df485193602
Unexpected sha256sum: 22c0e73b372fba0186c83b1b8d6572946b3d50415a5d1eb2699695dff96dd0ec
I asked internally and someone figured out that
$ head -c 3407856 go1.15.linux-amd64.tar.gz | sha256sum
22c0e73b372fba0186c83b1b8d6572946b3d50415a5d1eb2699695dff96dd0ec
produces the unexpected hash. To find the full internal conversation search internally for the unxpected hash.
Their recommendation was to audit the error reporting code that does the downloading since the code seems to have considered the request complete before the Content-Size header was fulfilled.
My expectation is that rather than reporting the wrong hash, that some other error be reported if the file could not be downloaded.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Audit the download code and try to write a unit test for anything that could cause a truncated file to be hashed.
What operating system are you running Bazel on?
Linux? This occurred on a CircleCI machine.
What's the output of
bazel info release
?I'm not sure, probably the latest release as I was using bazelisk.
Have you found anything relevant by searching the web?
No, I couldn't find anything else matching the error.
Any other information, logs, or outputs that you want to share?
Attached the logs.
bazel-wrong-sha.txt
The text was updated successfully, but these errors were encountered: