-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Speculative fix for repo contents cache race #26914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Could you elaborate a bit more on this? Why does this improve things? |
I updated the description, Skyframe usually wants |
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
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
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 <[email protected]>
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 <[email protected]>
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