Area#
apps/server
Steps to reproduce#
- Run the T3 server as a systemd user service on a Linux host that has swap, where a cgroup above the agents forbids it:
memory.swap.max is 0. Boat VMs (boat.dev) ship this way: a 2 GiB /swapfile, plus MemorySwapMax=0 on user.slice, set with systemctl set-property.
- Let agents run a build or type check that grows the agents slice past
MemoryHigh.
- Watch the agents slice's
memory.high, memory.events (high) and memory.pressure.
Expected behavior#
The same as on a host without swap since #39287: MemoryHigh=infinity, and MemoryMax OOM-kills a runaway in its own scope.
Actual behavior#
readHasSwap in apps/server/src/process/agentScope.ts only checks SwapTotal in /proc/meminfo. The host has swap, so the agents slice gets the finite MemoryHigh (max(RAM − 6 GiB, RAM / 2)), but the agents cannot swap. Reclaim at MemoryHigh has nowhere to put their anonymous memory, so the kernel throttles every agent and MemoryMax is never reached. This is the stall from #39195 on a host whose SwapTotal is not 0.
#39287 calls this case out under "Not in this change": a per-cgroup memory.swap.max=0 on a host with swap still gets the finite MemoryHigh. #39195 had asked for both checks.
Seen on 2026-11-26 on five Boat VMs (8 GiB and 16 GiB) running T3 as a user service:
- On an 8 GiB VM,
MemoryHigh was 3.97 GiB and MemoryMax 5.96 GiB. One tsc --noEmit that needed about 5 GiB sat at 4.2 GiB for two hours. Nothing was killed and nothing errored; the thread showed "running" with no new items.
ps showed the agent processes in state D with wchan mem_cgroup_handle_over_high, and memory pressure was near 99%.
- Two other VMs were stalled the same way at the same time.
Impact#
Major degradation or frequent failure
Version or commit#
0.1.12-nightly.20261124.5191 and 0.1.13-nightly.20261125.5245; code checked on main at b99dab9495
Environment#
Boat VMs: Ubuntu 24.04.4, kernel 6.8, systemd 255 user manager, 8 GiB and 16 GiB RAM, 2 GiB swap, MemorySwapMax=0 on user.slice
Workaround#
Turn swap off before T3 starts, for example ExecStartPre=-/usr/bin/sudo -n /usr/sbin/swapoff -a in a drop-in for t3code.service. T3 then sees SwapTotal 0 and sets MemoryHigh=infinity. A server that is already running only re-reads swap at its next agent launch.