[Bug] Scheduled task cron fires leak Claude Code processes and API sessions
Bug Description
SUMMARY
Scheduled-task cron fires leak Claude Code processes that never exit. Over hours
they accumulate, holding local RAM AND active Anthropic API session state that
keeps billing the account. Discovered 78 orphan processes / 5.6 GB RAM on one
laptop on 10 May 2026. Account token usage continued to drain ~2% even after
local cleanup, suggesting the server-side API sessions remain active.
REPRO
1. Create a scheduled task with a frequent cron (/5 *)
2. Let it run for ~1 hour
3. ps -eo pid,etime,command | grep claude.app | grep -v -- --resume
4. You'll see many orphan processes paired by start time, no --resume flag
EXPECTED
Each cron fire should: spawn → run task → exit cleanly, releasing the local
process and the server-side API session.
IMPACT
- 5.6 GB RAM leaked on one laptop
- ~150 MB of accumulated JSONL session files per day
- Continued account token drain after local cleanup (server-side sessions)
- iMessage plugin holds a single session for 10+ days (40 MB), replays full
context on every incoming text
WORKAROUND
Built a Bash sweeper that kills orphans (no --resume, age >10 min) running
3x/day. Patches the symptom locally; can't fix the server-side leak.
ALSO FILED
- GitHub: https://github.com/anthropics/claude-code/issues/57910
- Email: support@anthropic.com (from olusholaoladipupo1@gmail.com)
Environment Info
- Platform: darwin
- Terminal: Apple_Terminal
- Version: 2.1.136
- Feedback ID: e9b91ec8-6de0-48a0-8736-3eaa1ea4c1e7
Errors
[]This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗