| index ee57b7f40..461c6a01e 100644 |
| --- a/internal/host/units/carlos-edge.service |
| +++ b/internal/host/units/carlos-edge.service |
| @@ -54,8 +54,26 @@ MemoryDenyWriteExecute=yes |
| SystemCallFilter=@system-service |
| SystemCallErrorNumber=EPERM |
| SystemCallArchitectures=native |
| -# No MemoryMax: hibernating instances are this unit's children, so a cap here |
| -# would cap the whole set of awake instances at once. |
| +# The outer wall (memory-pressure spec 2026-08-28 §2.2). Exec-backed |
| +# instances are this unit's children, so these DO cap the whole set of |
| +# awake instances at once — that is now the point: on 2026-08-28 the |
| +# flagship thrashed for 15 minutes with no swap, no ceiling and an OOM |
| +# killer that never fired, because nothing bounded the tree. Percentages |
| +# so one file fits a t4g.micro and a t4g.medium; 80% leaves what the |
| +# box's other units (keymail, console, ssm, litestream, journald) use. |
| +# Past High the kernel reclaims the tree (page cache first, then zram); |
| +# at Max it kills the largest process in the tree — a tenant child, by |
| +# two orders of magnitude over the agent. Per-instance caps below this |
| +# (carlos-exec@<host> memory.max, internal/cgroup) are the inner walls. |
| +MemoryHigh=70% |
| +MemoryMax=80% |
| +# systemd's default OOMPolicy=stop STOPS the whole service when the kernel |
| +# OOM-kills ANY process in the unit's cgroup tree (memory.events is |
| +# hierarchical, delegation or not). Restart=always would bring the edge |
| +# back a second later and cycle every awake instance on the box. With |
| +# continue, one tenant's kill is one tenant's kill; the activator recycles |
| +# it on its next request. |
| +OOMPolicy=continue |
| TasksMax=1024 |
| # Exec-backed instances run as this unit's children. Delegation hands the |
| # unit its own cgroup subtree — chowned to User=carlos, unmanaged by systemd |