Repository navigation
Closed as not planned
Labels
area:corearea:toolsbugSomething isn't workingSomething isn't workinghas reproHas detailed reproduction stepsHas detailed reproduction stepsperf:memoryplatform:windowsIssue specifically occurs on WindowsIssue specifically occurs on WindowsstaleIssue is inactiveIssue is inactive
Description
Preflight Checklist
- I have searched existing issues and this hasn't been reported yet
- This is a single bug report (please file separate reports for different bugs)
- I am using the latest version of Claude Code
What's Wrong?
Description
Using /exit to close Claude Code while subagent tools are still running in the background causes system crashes. The /tasks command shows no active tasks, but orphaned processes remain and accumulate.
Steps to reproduce
- Start a long conversation that spawns subagent tasks
- Wait for apparent completion (no tasks shown via
/tasks) - Run
/exit - System crashes/freezes
Observed behavior
- Multiple orphaned
claudeprocesses (10+) remain after apparent task completion - Large
nodeprocess (~300MB+) persists - likely stuck subagent /exitdoesn't terminate these processes- Accumulated processes crash Windows
Expected behavior
/exitshould terminate all spawned processes- Subagent processes should clean up when parent task completes
Environment
- Windows 10/11
- Claude Code version: [run
claude --version]
Workaround
Manually kill processes before exiting:
Get-Process -Name "claude","node" | Stop-Process -Force
What Should Happen?
When /exit is called or a task completes, Claude Code should:
- Detect and terminate all spawned subagent processes
- Clean up any associated node processes
- Exit gracefully without leaving orphaned processes
- If processes cannot be terminated, warn the user before exiting
Error Messages/Logs
No error messages displayed - system freezes/crashes silently.
Pre-crash process state (captured via Get-Process):
- 10 orphaned `claude` processes (74MB-188MB each)
- 1 large `node` process (322MB RAM, 7.14s CPU) - likely stuck subagent
- Total: ~1.2GB RAM consumed by orphaned processes
No BSOD - Windows becomes unresponsive and requires hard reboot.
The `.claude` cache folder does not exist after crash, suggesting the issue is process accumulation rather than corrupted state files.Steps to Reproduce
- Start Claude Code and begin a complex task that spawns subagent tools (e.g., multi-file edits, research tasks, or anything using parallel processing)
- Allow task to run to apparent completion
- Check
/tasks- shows no active tasks - Run
/exitto close Claude Code - System becomes unresponsive/crashes
- After hard reboot, orphaned processes can be observed if caught before crash:
Get-Process | Where-Object { $_.ProcessName -match "node|claude" }
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
N/A - not confirmed as regression
Claude Code Version
2.0.76 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
No response
Reacted by muhtasham, Alexander Campbell and Quentin Hartman
Metadata
Metadata
Assignees
Labels
area:corearea:toolsbugSomething isn't workingSomething isn't workinghas reproHas detailed reproduction stepsHas detailed reproduction stepsperf:memoryplatform:windowsIssue specifically occurs on WindowsIssue specifically occurs on WindowsstaleIssue is inactiveIssue is inactive
Activity
github-actions commentedon Jan 15, 2026
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
JasenNelson commentedon Jan 15, 2026
This bug is related to 3 others identified by the github-actions[bot], but has one significant difference, it's crashing my Windows 11 Pro and forcing my computer to reboot. The underlying reason of subagents using tools that get stuck in loops and don't close with subagent completion and lack of primary agent awareness or tracking (via/tasks). Literally typing /exit in Claude Code results in immediately crash of Windows and loss of anything I had open.
The 3 other related posts provided by the bot include:
#17391
#15975
#17219
Muhtasham commentedon Jan 17, 2026
Also having same issue:
Version & Environment
Observed Behavior
Multiple claude processes running with high CPU, some orphaned (PPID=1):
Total: ~420% CPU from zombie claude processes.
Expected Behavior
When a Claude Code session terminates, all spawned background agents/subagents should be terminated via:
SIGTERM/SIGKILL to pgrp)Reproduction
ps -Ao pid,ppid,pcpu,etime,comm | grep claudefeat(plugin): add agent-teams-pipeline plugin
alexeyv commentedon Feb 25, 2026
Additional data point: subagent persists at high CPU during a live session (macOS, v2.1.53)
Same root cause, slightly different scenario from the original report. This happened during an active session, not after /exit.
What happened:
Discovery: Only found it hours later via ps aux. The process:
Killing the orphan killed the parent: When the user killed this unknown process, it took down the parent Claude session too -- suggesting the subagent process was still structurally linked to the parent despite appearing independent in ps.
Key distinction from original report: This is not about cleanup after /exit. The subagent finished its work, delivered results, and the parent kept going. The process just never terminated after completing its task.
Environment: macOS 26.3, ARM64, Claude Code 2.1.53, Bun runtime, --dangerously-skip-permissions
theQuert commentedon Mar 2, 2026
Community workaround: cc-reaper
I ran into the same orphan process accumulation issue on macOS — after several sessions,
claudesubagents and MCP servers pile up to 7+ GB of RAM (all with PPID=1, no controlling TTY).I built cc-reaper as a three-layer cleanup tool:
claude-ram(RAM usage report) andclaude-cleanup(manual kill)It targets
claude.*stream-json(subagents), MCP servers (mcp-server,context7,supabase, etc.), andchroma-mcpprocesses, using TTY filtering (awk '$7 == "??"') to only kill true orphans.One-line install:
git clone https://github.com/anthropics/cc-reaper && cd cc-reaper && bash install.shNot a fix for the root cause, but keeps RAM under control until the team addresses process lifecycle management properly. Hope this helps others hitting this issue.
abix- commentedon Mar 4, 2026
statusline.sh orphans on Windows
Statusline spawns bash.exe (Git Bash) per update. On Windows, they're never killed when the parent exits. 88 orphans in ~1h43m (~1/min). Same root cause -- no signal propagation through MSYS2.
Inline jq command still spawns bash.exe, so no user-side fix. We've disabled statusline on Windows.
github-actions commentedon Apr 1, 2026
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
github-actions commentedon Apr 9, 2026
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.