Task output files in tmpfs grow unbounded, can consume all system RAM

Resolved 💬 4 comments Opened Mar 28, 2026 by davidglogan Closed Mar 28, 2026

Summary

A single task output file (by37nmxd9.output) grew to 31GB in /tmp/claude-1000/, which is mounted as tmpfs (RAM-backed). This silently consumed half of the system's 61GB RAM, causing severe swap pressure and degraded performance for subsequent sessions.

Environment

  • Claude Code v2.1.84
  • Ubuntu Linux, 61GB RAM
  • /tmp mounted as tmpfs (default on modern Ubuntu)

What happened

  1. A session in a workspace spawned ~48 subagents for account planning tasks (Salesforce, SEC EDGAR, Apollo, web research)
  2. All subagent JSONL output was appended to a single task output file: /tmp/claude-1000/<project>/<session>/tasks/by37nmxd9.output
  3. The file grew to 31GB (20.7 million lines, 6.9 million agent messages)
  4. The file persisted after the Claude session exited, since tmpfs survives until reboot
  5. A subsequent overnight session ran for 8 hours (normally ~30 min) due to RAM starvation and swap thrashing

How it was discovered

Bash tool calls within Claude Code started failing (OOM kills). Investigating RAM usage revealed /tmp was 100% full — all tmpfs/RAM. The 31GB file was invisible to normal process-level debugging (ps, top, htop).

Impact

  • 31GB of RAM silently consumed by a temp file — not visible via ps, top, or htop
  • Subsequent Claude sessions severely degraded (8hr runtime instead of ~30min)
  • Significant API cost due to the slowdown
  • Attempting to even grep or dd from the file triggered OOM kills

Root causes (two issues)

  1. No size cap on task output files — output files in tmpfs can grow without limit. There's no rotation, truncation, or cleanup.
  2. No cleanup on session exit — task output files persist in tmpfs after the Claude session ends, continuing to consume RAM until reboot.

Suggested fixes

  • Cap task output file size (e.g., rotate or truncate at a reasonable limit)
  • Clean up task output files when a session exits
  • Consider writing large task outputs to disk rather than tmpfs, or at minimum warn when tmpfs usage is high
  • Consider the total tmpfs footprint across concurrent and sequential sessions

Reproduction

Run multiple large multi-agent workflows (e.g., account planning with Salesforce/SEC/web research agents) in the same session. Monitor /tmp/claude-1000/ size. The task output file grows monotonically with no bound.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗