Cache rotation logs unlinkat errors when it empties a bind-mounted cache #36

closed cmc opened this on 2026-09-11 19:03 UTC

Discussion

cmc 2026-09-11 19:03 UTC

When the media cache passes max-size, InitCacheSystem calls os.RemoveAll on the cache directory and then os.Mkdir. Inside the container the directory is a bind mount, so removing its contents succeeds but removing the directory itself fails, and every rotation pass logs:

unlinkat ./cache: permission denied
mkdir cache: file exists

Seen on art.krz.sh once the container had a real log driver. The cache is emptied as documented, so this is noise, but it fires every update-interval seconds while the cache is over the cap. Fix: remove the entries, not the directory. While there, consider trimming least recently used files down to the cap instead of emptying everything, which is what the SETUP.md note about "emptied, not trimmed" describes today.

closed by commit e2ccebb244 by cmc: Trim the media cache to its cap instead of emptying it

2026-09-11 19:26 UTC