Repository navigation
Conversation
- An object in hybrid storage has one expiry, so the copy in memory can't outlive the file. MemoryConfig.expiry is only used by memory-only storage. - Refuse DiskConfig names that aren't a single folder, because purging or removeAll() could delete files outside the cache. - Encode and decode outside the locks, and serve memory hits without waiting for another object's disk access. - Document that objects should be read with the type they were written as. - Add tests that compare all kinds of storage, cover the config's default expiry and use storage from many threads. Run Thread Sanitizer in CI.
A relative expiry was turned into a date before waiting for the lock, so a slow write to another key used up the object's lifetime, and could leave it expired by the time it was saved.
A DiskConfig name with a NUL passed the folder-name check. File system calls stop reading a path at a NUL, so purging could act on files far outside the cache, and it deleted every non-.cache file it found, subfolders included. - Refuse names with control characters, and a directory with a NUL - Purging and removeAll() only delete hash-named files directly in the cache folder, checking each one is really inside it - removeAll() deletes those files instead of the whole folder - Don't look inside subfolders Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hybrid storage worked out a relative expiry before taking the disk's lock, which disk reads and diskSize() hold without the hybrid lock. Waiting for them could use up the expiry, saving an object that had already expired. The disk now works out the date itself and hybrid storage gives the copy in memory the same one.
The gate waited without a limit for the other thread to get there, so a write that failed before reaching it hung the test.
Member
Author
|
Diagnostic done: the hang came from tests blocking every cooperative thread while waiting on DispatchQueue.global(), and a URL with a NUL comes out as file:/// on macOS 26. Both are fixed on #6. |
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.
Throwaway diagnostic for the test hang on PR 6. It will be closed without merging.