[2.0.x] bport: fall back to the onsite task when cache fails#8954
Merged
[2.0.x] bport: fall back to the onsite task when cache fails#8954
Conversation
**Problem** When the remote cache server (e.g. bazel-remote using S3 for storage) reports an AC (Action Cache) hit but the underlying CAS (Content Addressable Storage) blob is missing or corrupt, ActionCache.cache propagates the resulting exception (typically java.io.FileNotFoundException) directly to the SBT task engine process with no interception of the propogated error. This causes a build failure instead of a graceful cache miss. The three unguarded call sites are: 1. organicTask - syncBlobs after a successful put only caught NoSuchFileException, missing FileNotFoundException and other IO errors. 2. getWithFailure / readFromSymlink fast-path - syncBlobs inside flatMap with no exception handling. 3. getWithFailure main branch - both syncBlobs calls and the subsequent IO.read were completely unguarded. **Solution** Guard all three call sites with NonFatal catches: - Cache read failures (getWithFailure) return Left(None) which the caller interprets as a cache miss, triggering organic recomputation. - Cache write failures (organicTask) are demoted to a debug-level log; the task result that was already computed is returned successfully. Two regression tests are added to ActionCacheTest: 1. Tests the main getWithFailure branch using the default relative-path converter. 2. Tests the readFromSymlink fast-path using an absolute-path converter so the symlink created on the first run is found by Files.isSymbolicLink on the second.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a 2.0.x backport of #8890
Problem
When the remote cache server (e.g. bazel-remote using S3 for storage) reports an AC (Action Cache) hit but the underlying CAS (Content Addressable Storage) blob is missing or corrupt, ActionCache.cache propagates the resulting exception (typically java.io.FileNotFoundException) directly to the SBT task engine process with no interception of the propogated error. This causes a build failure instead of a graceful cache miss.
The three unguarded call sites are:
Solution
Guard all three call sites with NonFatal catches:
Two regression tests are added to ActionCacheTest: