navidrome/utils/cache
Deluan 4b9d2178cc fix(cache): give a re-created cache entry its own file
Create re-opened the path with O_TRUNC, which shrinks the file out from under an
older stream that may still be serving readers. stream.Reader then hits EOF from
the OS at the new, shorter length while the broadcaster still reports the original
size, so Wait() reports 'more data exists' and the reader retries forever - a tight
pread loop that burns a core and never releases its handle, which in turn blocks
Stream.Remove() indefinitely.

Unlink first and create with O_EXCL so the new entry gets a fresh inode. Existing
readers keep their descriptor on the old inode, see its full contents, and reach a
clean EOF.

Note this does not address the deferred unlink deleting the re-created file, which
is handled separately by the re-fetch in fileCache.Get.
2026-07-26 01:19:13 -04:00
..
benchmark_test.go chore: go fix 2026-05-28 22:13:05 -03:00
cache_suite_test.go Rename log.LevelCritical to log.LevelFatal 2022-12-21 14:53:36 -05:00
cached_http_client.go refactor: multiple syntax updates for Go 1.26 2026-05-19 18:02:36 -03:00
cached_http_client_test.go test: fix flaky tests in utils/cache (#5567) 2026-06-05 18:06:52 -04:00
file_caches.go fix(cache): re-fetch when a cache entry outlives its data file 2026-07-26 01:07:30 -04:00
file_caches_test.go fix(cache): re-fetch when a cache entry outlives its data file 2026-07-26 01:07:30 -04:00
file_haunter.go Remove potential integer overflow conversion uint64 -> int64 2024-08-22 19:28:22 -04:00
file_haunter_test.go test: fix flaky tests in utils/cache (#5567) 2026-06-05 18:06:52 -04:00
simple_cache.go fix: dedupe and cap concurrent lyrics plugin fetches (#5792) 2026-07-16 20:10:35 -04:00
simple_cache_test.go fix: dedupe and cap concurrent lyrics plugin fetches (#5792) 2026-07-16 20:10:35 -04:00
spread_fs.go fix(cache): give a re-created cache entry its own file 2026-07-26 01:19:13 -04:00
spread_fs_test.go fix(cache): give a re-created cache entry its own file 2026-07-26 01:19:13 -04:00