Clear the stranded tmpfs cache at startup

The session map is memory-only, so session directories surviving a restart
can never be served and never be evicted -- and the work root is a tmpfs,
so that is leaked RAM until reboot. The restart that ships the TTFB fix
would have stranded 1.56 GB.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-08-13 10:34:08 +01:00
parent d3616e7532
commit b35b6a3689
3 changed files with 61 additions and 0 deletions
+9
View File
@@ -1137,3 +1137,12 @@ fast mux keeping ranges and seeking, `--first-byte-grace` at `--wait-timeout`
restoring strict mode, a failed producer with bytes being served but 502 in strict
mode, a failed producer with no bytes always 502, `--growing` meaning no wait, and
`/healthz` reporting the mode. 353 pass.
### A restart used to strand the cache
The session map is in memory only, so every session directory left in the work root
after a restart is unreachable (nothing can find it) *and* unevictable (the cache
budget only sums tracked sessions). The work root is a tmpfs, so that is leaked RAM
until the next reboot — the restart that shipped the fix above would have stranded
1.56 GB. `reset_work_root()` now clears it at startup and logs what it reclaimed.
Session directories only; a stray file in the work root is left alone.