Filestore update deadlock - #2007
Merged
Merged
Conversation
chrisstaite
temporarily deployed
to
production
October 23, 2025 21:43 — with
GitHub Actions
Inactive
chrisstaite
temporarily deployed
to
production
October 23, 2025 21:43 — with
GitHub Actions
Inactive
chrisstaite
temporarily deployed
to
production
October 23, 2025 21:43 — with
GitHub Actions
Inactive
chrisstaite
force-pushed
the
update_deadlock
branch
from
October 24, 2025 10:12
74fe795 to
1f0c6a3
Compare
chrisstaite
temporarily deployed
to
production
October 24, 2025 10:12 — with
GitHub Actions
Inactive
chrisstaite
had a problem deploying
to
production
October 24, 2025 10:12 — with
GitHub Actions
Error
chrisstaite
had a problem deploying
to
production
October 24, 2025 10:12 — with
GitHub Actions
Failure
chrisstaite
force-pushed
the
update_deadlock
branch
from
October 24, 2025 10:23
1f0c6a3 to
97bf829
Compare
chrisstaite
temporarily deployed
to
production
October 24, 2025 10:23 — with
GitHub Actions
Inactive
chrisstaite
had a problem deploying
to
production
October 24, 2025 10:28 — with
GitHub Actions
Error
chrisstaite
had a problem deploying
to
production
October 24, 2025 10:28 — with
GitHub Actions
Error
chrisstaite
force-pushed
the
update_deadlock
branch
from
October 24, 2025 10:30
97bf829 to
5fed50f
Compare
chrisstaite
had a problem deploying
to
production
October 24, 2025 10:30 — with
GitHub Actions
Error
chrisstaite
had a problem deploying
to
production
October 24, 2025 10:30 — with
GitHub Actions
Error
chrisstaite
had a problem deploying
to
production
October 24, 2025 10:30 — with
GitHub Actions
Error
If there is a lot of files being created at the same time then there might be the case that the populator is attempting to write to a DropCloseWriterHalf but the DropCloseReaderHalf is blocked waiting for a file system semaphore. These are held by the FileSlot in FileSystemStore while it populates the temp file. This can lead to a deadlock where the readers are holding semaphores on the paths that don't have FileSlots and the ones that do have FileSlots don't have download semaphores. Ensure that the reader has the first chunk of data before taking the FileSlot. If the reader starts then we assume that we have all the permits we need to finish the file, therefore it should be safe to take the FileSlot semaphore.
chrisstaite
force-pushed
the
update_deadlock
branch
from
October 24, 2025 10:35
5fed50f to
260cc8d
Compare
chrisstaite
temporarily deployed
to
production
October 24, 2025 10:35 — with
GitHub Actions
Inactive
chrisstaite
temporarily deployed
to
production
October 24, 2025 10:35 — with
GitHub Actions
Inactive
chrisstaite
temporarily deployed
to
production
October 24, 2025 10:35 — with
GitHub Actions
Inactive
chrisstaite-menlo
enabled auto-merge (squash)
October 24, 2025 13:56
amankrx
approved these changes
Oct 28, 2025
rejuvenile
pushed a commit
to rejuvenile/nativelink
that referenced
this pull request
Jul 13, 2026
If there is a lot of files being created at the same time then there might be the case that the populator is attempting to write to a DropCloseWriterHalf but the DropCloseReaderHalf is blocked waiting for a file system semaphore. These are held by the FileSlot in FileSystemStore while it populates the temp file. This can lead to a deadlock where the readers are holding semaphores on the paths that don't have FileSlots and the ones that do have FileSlots don't have download semaphores. Ensure that the reader has the first chunk of data before taking the FileSlot. If the reader starts then we assume that we have all the permits we need to finish the file, therefore it should be safe to take the FileSlot semaphore.
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.
Description
If there is a lot of files being created at the same time then there might be the case that the populator is attempting to write to a DropCloseWriterHalf but the DropCloseReaderHalf is blocked waiting for a file system semaphore. These are held by the FileSlot in FileSystemStore while it populates the temp file. This can lead to a deadlock where the readers are holding semaphores on the paths that don't have FileSlots and the ones that do have FileSlots don't have download semaphores.
Ensure that the reader has the first chunk of data before taking the FileSlot. If the reader starts then we assume that we have all the permits we need to finish the file, therefore it should be safe to take the FileSlot semaphore.
Type of change
Please delete options that aren't relevant.
How Has This Been Tested?
Added a test that deadlocks without the change. It may not be the cause of #2001 but it certainly can't hurt.
Checklist
bazel test //...passes locallygit amendsee some docsThis change is