Claude Code hangs indefinitely during context compaction
Resolved 💬 6 comments Opened Jan 20, 2026 by TPG24 Closed Mar 1, 2026
Summary
Claude Code becomes completely unresponsive when attempting to compact/summarize a large context. The terminal freezes, Ctrl+C doesn't work, and the process becomes orphaned consuming excessive resources indefinitely.
Environment
- Claude Code version: 2.1.12
- OS: macOS 26.2 (Build 25C56)
- Architecture: Apple Silicon (arm64, M3 Max)
- Shell: zsh
Steps to Reproduce
- Start a Claude Code session
- Work on a complex task that generates a large context (multiple tool calls, large file reads, spawning subagents)
- Continue until the session approaches context limits (~23+ MB session file)
- When compaction/summarization is triggered, the terminal becomes completely unresponsive
Expected Behavior
- Compaction should complete within a reasonable timeout
- If compaction fails, Claude Code should gracefully handle the error
- Ctrl+C should be able to interrupt the process
- The process should not become orphaned
Actual Behavior
- Terminal goes completely blank/unresponsive
- Ctrl+C has no effect
- User must close the terminal window entirely
- The Claude process becomes orphaned (PPID=1) and continues running
- Orphaned process consumes excessive resources:
- CPU: 277%
- RAM: 11.8 GB (31% of system memory)
- Runtime: 26+ hours until manually killed
Diagnostic Information
Orphaned process details:
PID PPID STAT STARTED ELAPSED ARGS
34461 1 R Mon01PM 01-02:45:16 claude --dangerously-skip-permissions
Process was holding these files (no active session file):
stats-cache.json
cc-hud.json
secondbrain.json
settings.json
cc-statusline.json
history.jsonl
Session that likely triggered the hang:
- Workspace: secondbrain
- Session file size: 23.6 MB
- Session had already been compacted once (started with summary)
- Topic: "CampusIQ Tools Sync & Update Manager"
Impact
- Data loss: Any unsaved work in the session is lost
- Resource exhaustion: Orphaned process consumes ~12 GB RAM until manually killed
- User disruption: Must force-close terminal and hunt for zombie processes
Suggested Fixes
- Add timeout for compaction API calls - If summarization takes longer than X seconds, abort gracefully
- Preserve Ctrl+C handling - Ensure signal handlers remain active during compaction
- Add compaction progress indicator - Show user that compaction is in progress
- Graceful degradation - If compaction fails, offer to start a new session with a brief summary rather than hanging
- Session size warnings - Warn user when session file exceeds a threshold (e.g., 15 MB) before hitting critical limits
Workaround
Users experiencing this issue should:
- Check for orphaned processes:
ps aux | grep claude | grep -v grep - Look for processes with PPID=1 and high resource usage
- Kill orphaned processes:
kill -9 <PID>
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗