-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Remote downloader caches requests without digests #23932
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
Comments
That's a very reasonable suggestion (thanks for providing all the context!). The gRPC remote downloader is effectively ownerless right now, but I can pre-review a PR. |
Awesome! I'll open a draft PR sometime next week and we can discuss it in more detail there if needed. |
…e checksum This PR address the bazelbuild#23932 issue with remote downloader. Closes bazelbuild#23970. PiperOrigin-RevId: 686180819 Change-Id: Ia36c5793622bd1ac1fdaa9ef1326ddc385a5a01f
…thout the checksum (#23995) This PR address the #23932 issue with remote downloader. Closes #23970. PiperOrigin-RevId: 686180819 Change-Id: Ia36c5793622bd1ac1fdaa9ef1326ddc385a5a01f Commit 60638af Co-authored-by: Mislav Mandaric <[email protected]>
…thout the checksum This PR address the bazelbuild#23932 issue with remote downloader. Closes bazelbuild#23970. PiperOrigin-RevId: 686180819 Change-Id: Ia36c5793622bd1ac1fdaa9ef1326ddc385a5a01f (cherry picked from commit 60638af)
A fix for this issue has been included in Bazel 7.5.0 RC2. Please test out the release candidate and report any issues as soon as possible. |
Description of the bug:
We use rules_oci to build OCI images. After some time we noticed our builds are failing when using
experimental_remote_downloader
and after some digging we found out what the problem is.When downloading manifests,
rules_oci
first fetches a temporary token here. This token is then used for fetching the manifest here. If we configure bazel to useexperimental_remote_downloader
, all download requests will be routed through the remote asset api, which will cache the response for all requests and return subsequent responses from its cache. There is also an additional flag which we do use calledexperimental_remote_downloader_local_fallback
, which will retry the request with the local downloader when any error is returned from the remote downloader.What happens is the following:
401 Unauthorized
experimental_remote_downloader_local_fallback
flag, but the request that gets retried also uses the cached token, which means it also failsexperimental_remote_downloader
makes build pass againWhen fetching a token,
rules_oci
doesn't set the digest, with the expectation that it will not be cached as it is documented in DownloadManager:The unfortunate thing is that this only applies to the repository cache, not to the remote downloader. So even through omitting the digest will skip the local repository cache, it will not instruct the remote downloader to also not cache the request, resulting in an unexpected behaviour - repeating the same request to get the token will always result in returning the old cached token from the remote downloader.
Proposed solution:
Looking at the grpc downloader implementation of the remote downloader, it doesn't seem like it's doing anything with digests. So basically it's irrelevant if digests are used or not, all remote calls which are not cached by the local repository cache, land on the remote downloader api, which will cache them.
There is a field in the remote asset fetch api which allows callers to mark content as stale, but apparently bazel's grpc downloader is not setting it.
The proposal is to set
oldest_content_accepted
totime.Now()
if digest is not passed into the downloader. If you'd agree with this proposal, I can open a PR with this change.Which category does this issue belong to?
External Dependency
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
MODULE.bazel
.bazelrc
BUILD.bazel
Steps:
bazel build //...
-> successbazel build //...
-> successdebian12_slim
bazel build //...
-> failureWhich operating system are you running Bazel on?
macOS and Linux
What is the output of
bazel info release
?release 7.3.1
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?No response
If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
Link to Slack thread discussing this with @thesayyn, maintainer of rules_oci from Aspect: https://bazelbuild.slack.com/archives/C04281DTLH0/p1724410800783819
The text was updated successfully, but these errors were encountered: