Watch
0
0
Fork
You've already forked hyperhive
0

hive-priv: no agent container swaps, budgeted or not

The container drop-in wrote MemorySwapMax=0 only next to a finite
MemoryMax=. A container with MemoryMax=infinity kept host swap, so a
container over its memory share paged out and every process that
touched a paged-out page slept in D, out of reach of a signal.

limits_dropin_body now writes MemorySwapMax=0 for every container. The
OOM killer inside the container's cgroup takes over: subagent runs
(+900) and bash tasks (+1000) die before the agent's own session
(-500), as before. Docs say so.
This commit is contained in:
maia 2026-11-27 03:40:04 +01:00
commit dfd4212e10

View file

@ -491,12 +491,15 @@ changed cap reaches them at the next container start without a rebuild.
`hyperhive-memory-cap-check.service` logs a warning naming the path in the
container's journal. The container's `MemoryMax=` still applies.
A container with a finite `MemoryMax=` also gets, in the same drop-in,
`MemorySwapMax=0` and `MemoryHigh=` at 90% of the cap (bytes, rounded down).
A budgeted agent never swaps: paging it out to host swap would move the
pressure onto the host. Past 90% the kernel slows the container and reclaims
from it, and at 100% it kills. `MemoryMax=infinity` sets neither. Like the
rest of the drop-in, they reach a running agent at its next spawn or rebuild.
Every container also gets, in the same drop-in, `MemorySwapMax=0`, whatever
its `MemoryMax=`. No agent swaps: paging it out to host swap would move the
pressure onto the host, and every process that touches a paged-out page would
sleep in `D`, where a signal cannot reach it.
A container with a finite `MemoryMax=` also gets `MemoryHigh=` at 90% of the
cap (bytes, rounded down). Past 90% the kernel slows the container and
reclaims from it, and at 100% it kills. `MemoryMax=infinity` sets no
`MemoryHigh=`. Like the rest of the drop-in, they reach a running agent at its
next spawn or rebuild.
When the container reaches its cap, the kernel kills inside it, in this order:
@ -516,9 +519,8 @@ runs still get +900 and bash tasks +1000.
The container stays up through these kills. Each one counts in the
`hyperhive.container.memory.oom_kills` metric, shown as "OOM kills by agent"
on the health tab of the agents dashboard. `hyperhive.container.memory.swap.usage`
is the memory the container has swapped out: nonzero only for an agent with
no budget, or one whose container started before its drop-in carried
`MemorySwapMax=0`.
is the memory the container has swapped out: nonzero only for an agent whose
container started before its drop-in carried `MemorySwapMax=0`.
More than 3 kills of one agent in an hour raise the `hh-agent-oom-kills` alert.