Skip to content

Temporary: find the hung test - #8

Closed
gabors wants to merge 7 commits into
masterfrom
diag/test-hang
Closed

gabors wants to merge 7 commits into
masterfrom
diag/test-hang

Conversation

@gabors

@gabors gabors commented Nov 7, 2026

Copy link
Copy Markdown
Member

Throwaway diagnostic for the test hang on PR 6. It will be closed without merging.

gabors and others added 7 commits November 7, 2026 00:18
- 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.
@gabors

gabors commented Nov 7, 2026

Copy link
Copy Markdown
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.

@gabors gabors closed this Nov 7, 2026
@gabors
gabors deleted the diag/test-hang branch November 7, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant