Speculative fix for repo contents cache race#26914
Closed
fmeum wants to merge 2 commits intobazelbuild:masterfrom
Closed
Speculative fix for repo contents cache race#26914fmeum wants to merge 2 commits intobazelbuild:masterfrom
fmeum wants to merge 2 commits intobazelbuild:masterfrom
Conversation
The error message observed in bazelbuild#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 directory while another was between creating the directory and 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. Also harden `FileSystemLock` against other types of exceptions by not wrapping `InterruptedException` in an `IOException` and document that concurrent use on the same path is not supported.
Member
Could you elaborate a bit more on this? Why does this improve things? |
Collaborator
Author
I updated the description, Skyframe usually wants |
Wyverald
reviewed
Sep 9, 2025
bazel-io
pushed a commit
to bazel-io/bazel
that referenced
this pull request
Sep 10, 2025
The error message observed in bazelbuild#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 an `InterruptedException` instead of a `FileLockInterruptionException`. 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 bazelbuild#26713 Closes bazelbuild#26914. PiperOrigin-RevId: 805338728 Change-Id: Ie808ebe6113b935180b93c21679d5398aa168802
bazel-io
pushed a commit
to bazel-io/bazel
that referenced
this pull request
Sep 10, 2025
The error message observed in bazelbuild#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 an `InterruptedException` instead of a `FileLockInterruptionException`. 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 bazelbuild#26713 Closes bazelbuild#26914. PiperOrigin-RevId: 805338728 Change-Id: Ie808ebe6113b935180b93c21679d5398aa168802
github-merge-queue bot
pushed a commit
that referenced
this pull request
Sep 10, 2025
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 an `InterruptedException` instead of a `FileLockInterruptionException`. 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 Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Sep 16, 2025
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 an `InterruptedException` instead of a `FileLockInterruptionException`. 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 Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
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.
The error message observed in #26713 is consistent with
FileChannel#openfailing 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
IOExceptionduring normal operation is on an interrupt (such as the user hitting Ctrl+C). Instead, follow Skyframe best practices by surfacing this as anInterruptedExceptioninstead of aFileLockInterruptionException.Also document that concurrent use on the same path is not supported (it results in an
OverlappingFileLockExceptionif the lock is already held, regardless of whether that is in shared or exclusive mode) and why the current usages are safe.Fixes #26713