Skip to content

Fix action cache cold start crash on empty output base - #43

Merged
azad-uber-2 merged 1 commit into
uber/android/8.1.1from
azad/fix-action-cache-cold-start-8.1.1
Jul 16, 2026
Merged

azad-uber-2 merged 1 commit into
uber/android/8.1.1from
azad/fix-action-cache-cold-start-8.1.1

Conversation

@azad-uber-2

Copy link
Copy Markdown

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).

This is a follow-up fix to #41 which backported deleteUnrecognizedFiles from Bazel 9. That method calls cacheRoot.getDirectoryEntries() without checking if the action_cache directory exists first. On a cold cache (fresh output base with no prior builds), the directory hasn't been created yet, causing a crash: Couldn't create action cache: .../action_cache (No such file or directory). Bazel 7 is unaffected because it doesn't have deleteUnrecognizedFiles. The fix adds an early return when the directory doesn't exist — there are no files to clean up on a cold cache anyway, so the cleanup logic from #41 is preserved for all other scenarios.

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).
@azad-uber-2
azad-uber-2 merged commit 1657d0f into uber/android/8.1.1 Jul 16, 2026
4 checks passed
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