Skip to content

[Android] Backport action cache cleanup fix from Bazel 9 - #41

Merged
azad-uber-2 merged 1 commit into
uber/android/8.1.1from
azad/backport-action-cache-cleanup
Jul 2, 2026
Merged

azad-uber-2 merged 1 commit into
uber/android/8.1.1from
azad/backport-action-cache-cleanup

Conversation

@azad-uber-2

@azad-uber-2 azad-uber-2 commented Jul 2, 2026 •

Copy link
Copy Markdown

Backport of the fix for bazelbuild#26818 which causes Bazel 8 to corrupt the output base for Bazel 7 when alternating between versions on the same workspace.

The fix deletes unrecognized files from the action cache on-disk directory when loading it into memory. This prevents spurious cache hits for stale runfiles trees when the runfiles output manifest (a symlink to the input manifest) appears valid but the underlying tree was updated by an intervening build with a different Bazel version.

Original fix: bazelbuild#27525
Original commit: 912099e

Backport of the fix for bazelbuild#26818
which causes Bazel 8 to corrupt the output base for Bazel 7 when
alternating between versions on the same workspace.

The fix deletes unrecognized files from the action cache on-disk directory
when loading it into memory. This prevents spurious cache hits for stale
runfiles trees when the runfiles output manifest (a symlink to the input
manifest) appears valid but the underlying tree was updated by an
intervening build with a different Bazel version.

Original fix: bazelbuild#27525
Original commit: 912099e

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@azad-uber-2
azad-uber-2 merged commit 499a131 into uber/android/8.1.1 Jul 2, 2026
4 checks passed
azad-uber-2 added a commit that referenced this pull request Jul 9, 2026
Backport of the fix for bazelbuild#26818
which causes Bazel 8 to corrupt the output base for Bazel 7 when
alternating between versions on the same workspace.

The fix deletes unrecognized files from the action cache on-disk directory
when loading it into memory. This prevents spurious cache hits for stale
runfiles trees when the runfiles output manifest (a symlink to the input
manifest) appears valid but the underlying tree was updated by an
intervening build with a different Bazel version.

Original fix: bazelbuild#27525
Original commit: 912099e

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
azad-uber-2 added a commit that referenced this pull request Jul 16, 2026
The deleteUnrecognizedFiles method (backported from Bazel 9 in #41)
calls cacheRoot.getDirectoryEntries() without checking if the
action_cache directory exists. On a cold cache (fresh output base),
the directory hasn't been created yet, causing an IOException:
'No such file or directory'.

Bazel 7 doesn't have this issue because it lacks deleteUnrecognizedFiles.

The fix adds an existence check at the top of the method, returning
early if the directory doesn't exist yet (there are no files to clean
up anyway).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants