7b44106174
The budget in _sweep_agent_cache_under_pressure comes from the gateway's own cgroup memory.high/memory.max, but read_anon_rss_mb() read /proc/self/status RssAnon: only the main process. Every child in the unit (execute_code kernels, terminal commands) is charged against the same limit, so a kernel at 4.7 GiB pushed the unit to MemoryHigh while the valve saw <1.6 GiB and never fired; systemd's stop then SIGKILLed the gateway mid-flush (the #80764 signature). Under a capped cgroup v2, read own memory.stat `anon` (the same scope as the budget); uncapped, or when the file is unreadable, keep the self reading. _finite_limit is factored out of _cgroup_limit_bytes so the cap check and the budget agree on what "unlimited" means. Fixes #110549