[8.4.1] Speculative fix for repo contents cache race #26950
Merged
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.
The error message observed in #26713 is consistent with
FileChannel#open
failing because the given path doesn't exist. This could happen if one Bazel process observed that!entryDir.isDirectory()
, which is true if the path doesn't exist, and proceeded to delete the path while another process had just created the directory and is now opening the channel. Since the entry dir is never expected to be an existing non-directory unless the cache has been corrupted, this logic can be removed.Another possible source of
IOException
during normal operation is on an interrupt (such as the user hitting Ctrl+C). Instead, follow Skyframe best practices by surfacing this as anInterruptedException
instead of aFileLockInterruptionException
.Also document that concurrent use on the same path is not supported (it results in an
OverlappingFileLockException
if the lock is already held, regardless of whether that is in shared or exclusive mode) and why the current usages are safe.Fixes #26713
Closes #26914.
PiperOrigin-RevId: 805338728
Change-Id: Ie808ebe6113b935180b93c21679d5398aa168802
Commit ca1cbfe