Repository navigation
Fix race conditions in file cache and block cache - #1077
Open
jfantinhardesty wants to merge 2 commits into
Open
jfantinhardesty wants to merge 2 commits into
jfantinhardesty wants to merge 2 commits into
Conversation
jfantinhardesty
requested review from
Dabnsky,
Ferelith-maker,
brayan-trejo and
foodprocessor
as code owners
October 8, 2026 17:47
jfantinhardesty
had a problem deploying
to
testing
October 8, 2026 17:47 — with
GitHub Actions
Failure
jfantinhardesty
had a problem deploying
to
testing
October 8, 2026 17:47 — with
GitHub Actions
Error
jfantinhardesty
had a problem deploying
to
testing
October 8, 2026 17:47 — with
GitHub Actions
Error
jfantinhardesty
had a problem deploying
to
testing
October 8, 2026 17:47 — with
GitHub Actions
Error
jfantinhardesty
had a problem deploying
to
testing
October 8, 2026 17:47 — with
GitHub Actions
Failure
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Worker shutdown can still accept lost work, and block-cache workers still race with handle-path renames.
2 open findings
What changed in this PR
Fixes concurrency issues across cache, streaming, loopback, and xload components, with race-focused tests.
Changes:
- Synchronizes shared cache and handle state.
- Improves worker shutdown and async-operation cleanup.
- Adds regression tests for concurrent reads, writes, renames, expiry, and uploads.
| File | Description |
|---|---|
component/xload/xload_test.go |
Reorders configuration cleanup. |
component/xload/threadpool.go |
Revises worker shutdown. |
component/xload/threadpool_test.go |
Removes timing-dependent assertion. |
component/xload/stats_manager.go |
Synchronizes exporter shutdown. |
component/xload/splitter_test.go |
Stops all test components. |
component/xload/lister.go |
Localizes goroutine error state. |
component/stream/read.go |
Atomically reads cached-object count. |
component/stream/read_test.go |
Avoids unsafe mock comparisons. |
component/loopback/loopback_fs.go |
Locks handle-path updates and reads. |
component/loopback/loopback_fs_test.go |
Tests rename/read concurrency. |
component/file_cache/lru_policy.go |
Protects expiry-list inspection. |
component/file_cache/lru_policy_test.go |
Tests concurrent expiry updates. |
component/file_cache/file_cache.go |
Synchronizes workers, handles, and scheduling. |
component/file_cache/file_cache_test.go |
Adds race regression coverage. |
component/file_cache/async.go |
Locks upload-window transitions. |
component/block_cache/threadpool.go |
Snapshots scheduled file size. |
component/block_cache/threadpool_test.go |
Uses eventual async assertions. |
component/block_cache/block_cache.go |
Coordinates uploads and overwrites. |
component/block_cache/block_cache_test.go |
Tests upload/write races. |
component/attr_cache/cacheMap.go |
Uses copy-on-write attributes. |
component/attr_cache/attr_cache_test.go |
Tests immutable cached results. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch was successfully deployed
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.

What type of Pull Request is this? (check all applicable)
Describe your changes in brief
This fixes most races that can be detected using the race detector. (There are still some races that would require a fix in the upstream tlru). In the future, we could hopefully enable the race detector in our CI/CD as well. This also adds a few tests for race conditions that were found while running cloudfuse but were not in our test suite.
Checklist
Related Issues