Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Under Linux cgroup memory pressure, systemd-oomd kills active sessions/workers while idle ACP scopes sit untouched for 30 minutes #43888

Openbenjamin-di(GitHub profile, opens in a new tab) opened this issue 2 comments

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Run t3 (v0.1.12) as a systemd user service on Linux with systemd-oomd active (ManagedOOMMemoryPressure=kill on user@1000.service) and a bounded cgroup memory limit on app-t3code.slice (e.g. MemoryHigh=36G, MemoryMax=40G, MemorySwapMax=0).
  2. Run a parent Claude session that fans out ~12+ delegate_task workers on an ACP provider (Antigravity) alongside other recent ACP threads.
  3. Let delegated ACP workers complete and deliver their results while new workers and the parent session keep allocating.
  4. Observe app-t3code.slice memory usage and journalctl -u systemd-oomd.

Expected behavior

  1. Completed, delivered delegate_task ACP child sessions should not hold ~650–1,000 MiB of resident RAM (antigravity acp + t3 acp-mcp-bridge + MCP servers) for 30 minutes after finishing, and idle sessions should be shed before the agents cgroup hits memory pressure.
  2. Under systemd-oomd pressure, idle scopes should be preferred victims over active user sessions and active workers.

Actual behavior

  1. Finished ACP delegated workers stay alive for 30 minutes: PR #41174 lowered DEFAULT_IDLE_TIMEOUT_MS to 2 minutes (addressing #26413 for Claude), but AcpProviderCapabilitiesV2 declares supportsNativeResume: false, so every idle ACP session — including one-shot delegate_task workers whose result has already been delivered — falls back to NO_NATIVE_RESUME_IDLE_TIMEOUT_MS (30 minutes). Each idle ACP scope holds ~650–850 MiB of anonymous RAM (antigravity acp ~350 MiB, t3 acp-mcp-bridge ~260 MiB, plus MCP child processes). With ~15 idle ACP scopes sitting alongside ~12 active workers, resident memory accumulates to ~20+ GiB and pushes app-t3code.slice into MemoryHigh reclaim.
  2. systemd-oomd victim inversion kills active sessions first: All scopes under app-t3code-agents-*.slice launch with identical OOM settings (no ManagedOOMPreference distinction between idle/delegated scopes and active user sessions). Because systemd-oomd ranks victims by pgscan (reclaim activity) rather than RSS, idle 700 MiB–1.5 GiB ACP scopes (pgscan ≈ 0) are ignored while actively allocating sessions get killed first — including the active parent Claude session at 251.5 MiB and a newly started worker at 205.5 MiB.

Related: #26413 (same 30-minute delegate retention for Claude prior to #41174), #43662 (cgroup memory.swap.max=0 / MemoryHigh pressure stalls).

Impact

Major degradation or frequent failure

Version or commit

v0.1.12

Environment

Ubuntu Linux x86_64 (kernel 7.0, cgroup v2, systemd-oomd enabled), t3 v0.1.12 systemd user service, Claude + Antigravity ACP providers

Logs or stack traces

# systemd-oomd kills active low-RSS sessions with high pgscan while 15+ idle ~700 MiB ACP scopes remain untouched:
systemd-oomd: Considered 58 cgroups for killing, top candidates were:
  Path: .../app-t3code-agents-<hash>.slice/t3code-claude-5a0fad77.scope
  Pressure: Avg10: 14.09, Avg60: 5.38, Avg300: 1.30, Total: 4s
  Current Memory Usage: 251.5M
  Pgscan: 23640221
  Killed .../t3code-claude-5a0fad77.scope due to memory pressure for .../user@1000.service being 80.67% > 50.00% for > 20s with reclaim activity

systemd-oomd: Considered 61 cgroups for killing, top candidates were:
  Path: .../app-t3code-agents-<hash>.slice/t3code-acp-811e5060.scope
  Current Memory Usage: 205.5M
  Pgscan: 13270486
  Killed .../t3code-acp-811e5060.scope due to memory pressure ... 72.75% > 50.00% for > 20s

systemd-oomd: Killed .../t3code-acp-ae2ec1b4.scope (529.4M, Pgscan: 1395571)
systemd-oomd: Killed .../t3code-acp-dfe90852.scope (762.8M, Pgscan: 32552481)
systemd-oomd: Killed .../t3code-acp-4b36b5e4.scope (1.6G, Pgscan: 196120705)

Workaround

Reducing concurrent delegated ACP workers or waiting 30 minutes between waves for NO_NATIVE_RESUME_IDLE_TIMEOUT_MS to release finished ACP scopes.

  1. tanstack-source added labelsbug

  2. Same root on small machines, with numbers in case they help.

    Setup: t3 v0.1.11 and v0.1.13 as a systemd user service on Ubuntu VMs with 4 GB RAM, zram swap (systemd-zram-generator's default, half of RAM), agent scopes on (so app-t3code-agents.slice gets MemoryHigh ≈ 2 GB, MemoryMax ≈ 3 GB).

    • Each idle Antigravity session (agy plus its bridge) holds 110–300 MB for the 30-minute no-native-resume keep. About 4 fit beside everything else; past 11 the zram device is full, and without systemd-oomd the 12th thread stalled the slice at MemoryHigh for over 4 minutes: nothing reached MemoryMax, nothing was killed.
    • With systemd-oomd watching the slice, ManagedOOMSwap=kill (ranked by swap use, so the longest-idle session goes first) acted before ManagedOOMMemoryPressure=kill in every run, which avoided the inversion described above. When memory filled faster than oomd's window, the kernel's OOM killer still ended new sessions' programs during their first turn (7 in one run).

    Releasing idle no-native-resume sessions under memory pressure, or a setting for the 30-minute keep, would remove all of this on small machines.

  3. Thanks for the numbers — good to see the same 30-minute idle-scope buildup reproducing on smaller 4 GB VMs as well, and interesting that ManagedOOMSwap=kill ordered idle sessions ahead of ManagedOOMMemoryPressure=kill until fast fills hit the kernel OOM killer.

    Agree that releasing idle no-native-resume sessions under memory pressure (or making the 30-minute keep configurable) would address both cases.

Sign in to join this conversation.