Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
area:coreautocloseIssue will be closed automaticallyIssue will be closed automaticallybugSomething isn't workingSomething isn't workinghas reproHas detailed reproduction stepsHas detailed reproduction stepsmemoryperf:memoryplatform:macosIssue specifically occurs on macOSIssue specifically occurs on macOS
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?
After running Claude Code for approximately 14 hours, the process became stuck and consumed excessive system resources, making the entire system unresponsive.
Issue Details:
- Process stuck in running state with extreme resource consumption
- Memory usage: ~23GB (virtual memory)
- CPU usage: 143% sustained
- Fault counter overflow: 2,147,483,647 (max int32)
- System experienced severe swap thrashing (337M swap-ins, 361M swap-outs)
- Process did not terminate automatically
- Required kill -9 to terminate
System Impact:
- System became nearly unresponsive
- Load average spiked to 5.32+ (normal: <2)
- Only 95MB of 18GB RAM remained free
- 10GB+ of data compressed in memory pressure
- 15 processes stuck waiting for resources
Environment:
- Claude Code version: 2.0.22
- OS: macOS 15.5 (24F74)
- Hardware: Apple M3 Pro, 18GB RAM
- Process runtime: 13 hours 56 minutes before kill
Process Stats (from top):
PID 68794:
%CPU: 143.8
MEM: 23GB (VSZ: 516274048 KB)
TIME: 13:56:30
FAULTS: 2147483647 (overflow)
STATE: running/stuck
Reproduction:
Unknown - process was left running overnight with normal Claude Code usage
Expected Behavior:
Process should either:
- Self-terminate when idle
- Implement memory limits/cleanup
- Detect stuck state and exit gracefully
Workaround:
Monitor for stuck processes and manually kill with kill -9
What Should Happen?
What Should Happen?
Claude Code's compacting operation should complete reliably:
1. **Timeout mechanism**: Compacting should have a maximum timeout (e.g., 5 minutes)
2. **Progress indicator**: Show compacting progress or that operation is running
3. **Graceful failure**: If compacting fails/hangs, abort and allow process to continue/exit
4. **Non-blocking**: Compacting should not block terminal closure or user interactions
5. **Resource limits**: Even if stuck, process should cap memory usage
6. **Health check**: Detect hung operations and auto-restart or exit cleanly
**Expected behavior on terminal close:**
- If compacting is running, either:
- Complete it quickly (< 5 seconds), or
- Cancel it and save state for next launch, or
### Error Messages/Logs
```shell
Error Messages/Logs
No error messages were displayed to the user. Process appeared stuck/hung.
System-level diagnostics from `top -l 1`:
PID COMMAND %CPU TIME MEM STATE FAULTS
68794 claude 143.8 13:56:30 23GB running 2147483647
Memory pressure (`vm_stat`):
Pages stored in compressor: 2702322
Compressions: 3654510494
Swapins: 333726653
Swapouts: 357130544
Load average: 5.32 (normal < 2.0 for M3 Pro)
Physical memory: 17GB used / 18GB total (only 95MB free)Steps to Reproduce
Reproduction scenario:
- Launch Claude Code in terminal:
claude - Use normally until Claude Code performs an internal compacting operation
- Compacting operation hangs/freezes
- Terminal window becomes unresponsive with UI stuttering/flickering
- Terminal cannot be closed because it's waiting for the compacting task to complete
- Process continues running indefinitely, consuming increasing amounts of RAM and CPU
- After ~14 hours, process reaches 23GB RAM and 143% CPU usage
Key observations:
- Trigger: Compacting operation (likely database/index compaction)
- Symptom: Terminal froze during compacting, UI started stuttering
- Root cause: Compacting task never completed, blocking terminal closure
- Result: Process hung indefinitely, leaking memory and CPU
Environment:
- Multiple Claude Code terminal sessions were open
- macOS 15.5, Apple M3 Pro, 18GB RAM
- Claude Code version 2.0.22
To detect if you're affected:
# Check for hung Claude processes
ps aux | grep claude
# Look for processes with:
# - High runtime (several hours)
# - CPU > 100%
# - Memory > several GB
Critical bug: Compacting operation can hang indefinitely, preventing graceful shutdown and causing severe resource leaks.
### Claude Model
Sonnet (default)
### Is this a regression?
Yes, this worked in a previous version
### Last Working Version
_No response_
### Claude Code Version
Claude Code version: 2.0.22
### Platform
Anthropic API
### Operating System
macOS
### Terminal/Shell
VS Code integrated terminal
### Additional Information
_No response_Reacted by detailles and Alexander Garber
Metadata
Metadata
Assignees
Labels
area:coreautocloseIssue will be closed automaticallyIssue will be closed automaticallybugSomething isn't workingSomething isn't workinghas reproHas detailed reproduction stepsHas detailed reproduction stepsmemoryperf:memoryplatform:macosIssue specifically occurs on macOSIssue specifically occurs on macOS
Activity
github-actions commentedon Nov 10, 2025
Found 3 possible duplicate issues:
claude --continuecauses 28GB memory usage #10505This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
xssdem commentedon Nov 10, 2025
👎
This is NOT a duplicate - my issue has a specific root cause not mentioned in the other issues:
Key differences:
Relation to #10505:
While #10505 involves a runaway write loop, my issue is about a stuck compacting operation that blocks terminal closure. The compacting task hung, preventing graceful shutdown and causing the process to leak
resources indefinitely.
Root cause: The compacting operation has no timeout mechanism and can hang indefinitely, preventing process termination and causing severe resource leaks.
This is a distinct bug requiring investigation into the compacting operation specifically.
github-actions commentedon Dec 11, 2025
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
github-actions commentedon Jan 11, 2026
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
github-actions commentedon Jan 20, 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.