claude-code - 💡(How to fix) Fix [Bug] Scheduled task cron fires leak Claude Code processes and API sessions [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#57912Fetched 2026-05-11 03:22:09
View on GitHub
Comments
1
Participants
1
Timeline
8
Reactions
0
Participants
Timeline (top)
labeled ×5closed ×1commented ×1cross-referenced ×1

Fix Action

Fix / Workaround

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

Code Example

[]
RAW_BUFFERClick to expand / collapse

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

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 2.1.136
  • Feedback ID: e9b91ec8-6de0-48a0-8736-3eaa1ea4c1e7

Errors

[]

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Bug] Scheduled task cron fires leak Claude Code processes and API sessions [1 comments, 1 participants]