Skip to content

requirement 2.0f can detect an unbounded container cgroup but nothing can set memory.high, so the fix is an operator recipe that every container recreation silently undoes

Id: TD-PPagop-26090401 · Status: resolved · Filed: 2026-09-04 · Resolved: 2026-09-08 · Ref: #1296

Requirement 2.0f’s memory_cgroup_verdict (lib/memory.sh) reports unbounded when this container’s cgroup has a real memory.max but memory.high unset — the state in which the cgroup ratchets page cache up to its hard ceiling and returns it only under pressure. Measured on the ockham node 2026-09-04, two schedulers left in that state held 2465 MiB between them while idle, with only 51 MiB of it anonymous; setting memory.high to 768 MiB cut the combined live-cycle peak from 2490 MiB to 1476 MiB with no new hard-limit hits and no OOM kills.

Nothing in this repository can apply that fix. Docker exposes no memory.high setting (Compose has no key, and there is no docker run flag), and a container can read its own cgroup v2 files but never write them — /sys/fs/cgroup is mounted ro and the process runs as uid 1000. So the remedy is a host-level sudo tee into /sys/fs/cgroup/docker/<id>/memory.high, documented in deploy/docker/compose.yaml, which is reset every time the container is recreated: docker compose up -d, a watchtower roll, or a host reboot. A node that rolls its image nightly therefore spends most of its life unbounded again, and the only thing that notices is a doctor.sh line nobody is required to read.

Related and deliberately not conflated: docker info on this host warns “No swap limit support” and Compose’s memswap_limit is silently inert, so a container over its ceiling swaps rather than being OOM-killed — which on a memory-capped VM is what freezes the host. That warning is a false negative: the kernel accepts a direct write to memory.swap.max (verified 2026-09-04), Docker’s own cgroup-v1 probe simply fails to detect the capability. Both knobs have the same shape of problem and the same shape of fix.

Where: lib/memory.sh (memory_cgroup_verdict, memory_cgroup_describe), deploy/docker/compose.yaml’s scheduler resource block. Suggested fixes: (1) a profile-gated privileged governor sidecar in compose.yaml — it fits the existing sidecar pattern (tailscale, watchtower, egress-proxy), sets memory.high and memory.swap.max on its siblings at start, and re-applies after a roll, at the cost of one privileged container per node; (2) run the scheduler with cgroup: host plus a writable /sys/fs/cgroup bind so the entrypoint can set its own knobs before dropping privileges, which is a smaller blast radius than (1) but changes the container’s isolation posture; or (3) leave it an operator recipe and make the unbounded verdict travel — into the heartbeat and onto the dashboard beside the other node badges — so a node that silently reverted after a roll is visible without anyone running doctor.sh by hand.

Default: (3), make the verdict travel. It is the only one of the three that costs no privilege and no isolation change, and the measured harm is not that the knob is unset once but that nobody finds out when a roll unsets it again.

Section titled “Default: (3), make the verdict travel. It is the only one of the three that costs no privilege and no isolation change, and the measured harm is not that the knob is unset once but that nobody finds out when a roll unsets it again.”

Noticed while implementing requirement 2.0f; the detection landed, the remedy did not.

Fixed by a fourth option this record did not consider: bound the scheduler’s parent cgroup, chosen with Compose’s cgroup_parent, instead of the container’s own. The parent is not what gets recreated, so the ceiling it carries is not what gets wiped — which is the entire failure recorded above, addressed rather than reported.

It costs what option (3) costs and no more: no privileged sidecar (1), no cgroup: host and no writable /sys/fs/cgroup (2), no change to the scheduler’s isolation posture, and nothing new running on the node. Under the systemd driver the parent is a slice unit, so systemd re-applies MemoryHigh= on every start and a reboot is covered too; under cgroupfs it is a directory that survives recreation but not a reboot, so the setup script installs a boot hook — a unit where systemd is PID 1, a root @reboot crontab line where it is not, which on the ockham node it is not.

The half-life is also shorter than “until the next recreation” on a systemd-driver host, which this record did not know: any systemctl daemon-reload erases a container-level memory.high, on a live container, with nothing recreated and nothing restarted (verified on the poetic node 2026-09-08 — written, read back, one unrelated reload, back to max while the container kept running). systemd re-applies the properties a unit declares on every reload, and a docker-<id>.scope declares no MemoryHigh, so re-applying means resetting it; a package upgrade touching any unit is enough. The same mechanism is why a slice parent is durable rather than merely longer-lived: a slice unit does declare MemoryHigh, so that reload re-asserts the ceiling instead of clearing it (verified the same day, same host).

Why not the recorded default. Option (3) — make the unbounded verdict travel to the dashboard — was right that “the measured harm is not that the knob is unset once but that nobody finds out when a roll unsets it again”, and wrong only in what follows from it. It would have made this fleet’s schedulers warn roughly hourly, forever, about a condition whose only remedy was to re-run the recipe that produced it. Measured 2026-09-08, after the recipe was applied by hand to all four schedulers: three of the four had lost it within 90 minutes to ordinary rolls, and one had hit its hard ceiling 23,995 times in the 92 minutes since (agent-ops#1266). A ceiling with that half-life does not need better reporting.

The visibility half of (3) is kept, because it is still needed and is now actionable rather than merely repetitive. memory_cgroup_verdict gained a parented verdict, and doctor.sh now warns — where it used to say [ ok ] — on a memory.high set on the container itself, naming it as something the next roll will wipe. So the transient state is visible as transient, and the durable one reads as healthy.

One thing the container genuinely cannot do, and does not pretend to: infer the parent’s ceiling. A cgroup namespace makes the container’s own cgroup the root of what it can see, and the kernel exposes no effective hierarchy-wide memory.high. Verified on the poetic node 2026-09-08 — a container held to 64 MiB by its parent read its own memory.high as max and its own memory.events high as 0 while the parent counted 250 reclaim events; the only trace in the child was pgscan/pgsteal, which rise under ordinary host pressure too. So the parent’s memory.high is bind-mounted into the scheduler read-only, one file, defaulting to /dev/null — a measurement rather than an inference, and narrower than handing the fenced container a view of the host’s cgroup tree.

Not addressed here, and still open: the memory.swap.max half of the “Related and deliberately not conflated” paragraph above. Same shape of problem, same shape of fix, and nothing in this change forecloses it.