[BUG] Claude Code v2.1.9 Complete Freeze - 100% CPU, Main Thread Stuck in Infinite Loop (macOS ARM64)
Summary
Claude Code v2.1.9 session became completely unresponsive, consuming 100% CPU and ~7GB RAM for nearly 2 hours. The main thread is stuck in an infinite loop with no progress. This appears to be a continuation of the freeze/hang issues reported in earlier versions.
Keywords for discoverability: freeze, hang, stuck, unresponsive, 100% CPU, spinning, infinite loop, main thread blocked, macOS, ARM64, Apple Silicon, M4, Bun runtime, kill -9 required
---
Related Issues
This bug is related to and may be a regression of:
| Issue | Title | Version | Status |
|-------|-------|---------|--------|
| #1554 | Hanging/Freezing in the middle of work | v1.0.10 | OPEN |
| #6474 | Unresponsive hang with 120% CPU usage | v1.0.89, v2.0.x | OPEN |
| #11339 | 100% CPU in interactive mode on macOS | v2.0.36 | Closed (Fixed) |
| #11377 | Memory leak with 143% CPU after 14 hours | v2.0.22 | Closed |
| #4580 | 100% CPU during multi-agent task JSON serialization | v1.x | OPEN |
| #6705 | claude doctor hangs indefinitely, 100% CPU | v1.0.95 | OPEN |
| #10481 | Complete UI Freeze - ReadFileUtf8 I/O Block | v2.0.28 | OPEN |
---
Environment
| Component | Value |
|-----------|-------|
| Claude Code Version | 2.1.9 |
| Platform | macOS 15.7.3 (Build 24G419) |
| Architecture | ARM64 (Apple Silicon) |
| CPU | Apple M4, 10 cores |
| RAM | 32GB |
| Kernel | Darwin 24.6.0 |
| Terminal | /dev/ttys011 |
---
Symptoms
- ❌ Complete UI freeze - No response to any input
- ❌ 100% CPU on single core - Main thread spinning indefinitely
- ❌ ~7GB memory consumption (RSS), 2GB physical footprint
- ❌ Cannot interrupt - Only
kill -9terminates the process - ❌ Work lost - Must force quit and lose session state
- ✅ Network connections remain open - Server-side appears fine
---
Process State When Frozen
PID CPU% MEM% RSS STATE ELAPSED COMMAND
36202 100.1 20.9 6.7GB R+ 01:55:44 claude
| Metric | Value |
|--------|-------|
| CPU Time Consumed | 8+ minutes |
| Wall Clock Time Frozen | ~2 hours |
| Launch Time | 13:24:28 |
| Sample Time | 15:20:12 |
---
Stack Sample Analysis
A 10-second sample (8500 samples at 1ms intervals) shows 100% of samples on the main thread in a tight loop.
Thread Summary
| Thread | Role | Status |
|--------|------|--------|
| Main Thread (com.apple.main-thread) | Event loop | 🔴 SPINNING - 8500/8500 samples |
| Bun Pool 0-7 | Worker threads | Idle |
| HTTP Client | Network | Idle |
| File Watcher | FS events | Idle |
| JavaScriptCore libpas scavenger | GC | Idle |
| Heap Helper Threads (x3) | GC | Idle |
Hot Path (Main Thread)
The main thread is stuck in this call path (symbols stripped, showing offsets):
8500 start (in dyld)
└─ 8500 ??? (in 2.1.9) + 0x3f90
└─ 8500 ??? (in 2.1.9) + 0x536c
└─ 8500 ??? (in 2.1.9) + 0x26a430
└─ 8500 ??? (in 2.1.9) + 0x1121cd0
└─ 8500 ??? (in 2.1.9) + 0x2ab770
└─ ... (deep into JS/Bun runtime)
System Calls in Hot Path
_platform_memmove (libsystem_platform.dylib) ← Memory copy operations
__bzero (libsystem_platform.dylib) ← Memory zeroing
pthread_getspecific (libsystem_pthread.dylib) ← Thread-local storage
os_unfair_lock_lock/unlock (libsystem_platform) ← Lock operations
task_info (libsystem_kernel.dylib) ← Process info queries
This pattern suggests:
- Possible infinite loop with repeated memory allocations
- Or runaway JSON serialization/parsing
- Or regex catastrophic backtracking
- Or busy-wait polling loop (similar to #11339)
---
Network State
The process maintained active connections to Anthropic servers:
tcp4 192.168.1.136:59404 -> 160.79.104.10:443 ESTABLISHED
tcp4 192.168.1.136:58472 -> 160.79.104.10:443 ESTABLISHED
IP 160.79.104.10 confirmed as Anthropic infrastructure (ARIN: AP-2440). This indicates the freeze is client-side - server connections remain healthy.
---
Open File Descriptors
FD TYPE NAME
0-2 CHR /dev/ttys011 (terminal)
12 TCP -> 160.79.104.10:443 (Anthropic API)
37 TCP -> 160.79.104.10:443 (Anthropic API)
43 REG ~/.claude/settings.local.json
47 REG ~/.claude/history.jsonl
---
System State (Not Overloaded)
Load Average: 1.78, 1.64, 1.60
CPU: 20.70% user, 12.33% sys, 66.96% idle
RAM: 31GB used, 654MB free (32GB total)
Processes: 740 total, 5 running
The system was not under heavy load - this is isolated to the Claude Code process.
---
Reproduction
Unable to determine exact trigger - the freeze occurred during normal interactive usage. However, based on related issues, potential triggers include:
- Search/grep operations (#6474)
- Multi-agent/Task tool usage (#4580)
- Large context or file operations (#1554)
- Interactive prompt mode (#11339)
---
Workaround
Force kill the frozen process:
kill -9 $(pgrep -f "claude" | head -1)
---
Suggested Fixes
Based on analysis and related issues:
- Add watchdog timer - Detect main thread stalls > N seconds
- Implement operation timeouts - Prevent infinite loops in parsing/serialization
- Use async I/O properly - Avoid busy-wait polling (fix from #11339 may have regressed)
- Add SIGINT handler - Allow graceful interrupt even when stuck
- Memory operation limits - Cap allocation loops
---
Attachments
Full stack sample available (175KB, 8500 samples over 10 seconds). Happy to provide if needed.
---
For Other Users Experiencing This
If you're finding this issue because Claude Code froze on you:
- To kill a frozen session:
```bash
# Find the PID
ps aux | grep claude
# Kill it (only -9 works when frozen)
kill -9 <PID>
```
- To capture diagnostic info before killing:
```bash
# Get stack sample (macOS)
sample <PID> -f /tmp/claude_sample.txt
# Get process info
ps -p <PID> -o pid,ppid,state,time,etime,pcpu,pmem,rss,command
# Get open files
lsof -p <PID>
```
- Workarounds that may help:
- Use shorter sessions
- Avoid very large file operations
- Try
claude --resumeinstead of--continueafter recovery
---
/cc @bcherny (assigned on #1554)
29 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
M4 Pro Mac, getting same on 2.1.9. Running "claude" nothing happens - have to kill it.
I had few freezes yesterday and I opened other terminal with -c continue and the app refreshed.
This issue appeared in recent versions of CC, since ~2.1.0 I'm getting increased number of freezes (many per day), sometimes when claude tries to read large files/command outputs, sometimes it just gets stuck after a Bash tool use.
My report was a mistake. I was sshed in and Claude had a macOS pop up saying it was an app from Internet and I needed to click yes. But Ui via ssh doesn't make that clear etc
It seems that it's somehow related to working with large files or MCP responses. For me, it's mostly when I do stuff with playwright.
Same here, HP Spectre x360 with arch and froze after using grep on a really big markdown file. Closing tab doesn't kill the process and in some cases just hitting the button to resume the conversation freezes too so I can't continue the same chat.
same issue when grep big xml, log, md files.
Worth mentioning: for me it started happening only after a while, once the conversation got bigger. I switched back to 2.0.x, which doesn’t have this bug. When I find a moment, I’ll try to grab a stack trace and process info (if possible).
I finally gave up and switched back to 2.0.76; 100% reproducible freezing immediately went away.
2.1.12 was reproducibly freezing with 100% cpu on macos when reviewing a PR that had a large (>2k lines) VCR cassette diff.
Unfortunately 2.1.x appears "literally unusable" right now; only switched back to 2.0 because this happened multiple times in multiple different situations; this is really a show-stopper right now and makes claude code pretty much unusable.
i am trying this now. for me claude code has been 'literally unusable' for a couple of days.
for anyone else that wants to try this, i found claude code continually updated itself until i launched with this command
$env:DISABLE_AUTOUPDATER=1; claudeAdditional reproduction details
Experiencing the same 100% CPU freeze, plus a variant where it silently crashes instead of freezing.
My environment:
Observations:
New variant - Silent crash:
Tried:
The project-specific nature suggests something about project size, file count, or configuration triggers this.
(Originally filed as #21006, closed as duplicate)
Update: MCP ruled out as cause
Ran with
CLAUDE_MCP_DISABLE=1- same crash occurs.The crash pattern is consistent:
High write ratio: blit=X, write=Y (78%+ writes), screen=22x123This suggests the crash is in the rendering/display loop, not network or MCP related.
How to reproduce (happened four times already):
Clone ClickHouse repository:
Launch Claude:
And prompt:
Result:
https://pastila.nl/?00694b87/3b05f313bb3cc002ee717649c370ad23#RWoIWr8G7hIgszGKzL6UQg==GCM
Yeah this needs to be investigated asap, I just lost a couple days off my 300$ sub. Software completely incapacitated, completely locks up with no explanation. --debug is useless, seemingly no pattern. It eventually dies with SIGABRT I believe
If I launch with a brand new .claude, then it works. After bisecting I found that the lockup is triggered by reintroducing simply the projects directory. However if I recall it seemed that even opening inside a brand new directory/project still produces the lockup. It's possible the index itself is causing it.
My setup was working fine until it randomly stopped today mid-day. I think the auto-updater ran updated to
2.1.27(not sure from which working version) and then I get the same 100% CPU utilization freeze issues on mac 15.1 (24B83)I had to uninstall claude completely, install specific version
npm install -g @anthropic-ai/claude-code@2.0.76and turn off the auto-updater that is installing the bricked binary. Otherwise claude will work on the first run with2.0.76and install the broken2.1.27bin and the nextclauderun will freeze.Added
to my settings for now and it seems to be working ok
Having this issue with 2.1.27 too, everything just freezes as soon as a prompt is submitted.
Downgrading (and disabling auto-update) to 2.1.23 works for me.
same issue, donwgrade to 2.1.23 worked
2.1.25 doesn't exhibit a hard freeze at startup... 2.1.27 does.
<img width="1160" height="112" alt="Image" src="https://github.com/user-attachments/assets/e39de142-abae-4fa1-a655-9cffe48d06ae" />
Honestly, it's just so tiring, surely this is not rocket science?
For those hitting the 100% CPU freeze on resume — this is often caused by the session JSONL file growing too large for efficient parsing. Progress entries, subagent outputs, and duplicate blocks accumulate without pruning.
Cozempic can reduce the file size before resume to prevent the freeze:
The
aggressivetier applies all 13 strategies including mega-block trimming (>32KB blocks) and document dedup — useful when the session is already too large to resume normally. Backups are automatic.Linux x86_64 Core Dump Analysis — V8 Property Lookup Infinite Loop (v2.1.34)
Confirming the same bug on Linux x86_64 with Claude Code v2.1.34. I captured a full core dump via
gcorebefore SIGKILL, providing instruction-level root cause.Environment
| Component | Value |
|-----------|-------|
| Claude Code | 2.1.34 |
| Platform | CachyOS (Arch), Linux 6.18.9-2-cachyos |
| CPU | AMD (x86_64) |
| Binary |
~/.local/share/claude/versions/2.1.34(statically compiled, stripped) |Live Process State Before Kill
| Metric | Value |
|--------|-------|
| CPU | 54% sustained (single main thread) |
| RSS | 2.3 GB |
| Runtime | ~8 minutes before detection |
| TCP Connections | Zero (no API connection) |
| Disk Writes (5s sample) | 0 bytes |
| Disk Reads (5s sample) | ~92 KB (internal only) |
| SIGTERM | Ignored — required SIGKILL |
Syscall Profile (5-second strace)
Thread Analysis from Core Dump (30 threads)
| Group | Count | Address | Syscall | State |
|-------|-------|---------|---------|-------|
| Main (V8 JIT) | 1 |
0x4687efain binary | userspace — not in any syscall | Spinning in V8 JIT code || libuv workers | 18 |
0x3041383|futex(WAIT)on shared condvar0x667a9e4| Idle — all on same futex || Event loop | 1 |
0x3a4f03a|epoll_pwait2(fd=14)| Normal (EINTR from gcore) || V8/platform | 9 |
0x7f53af4b0872in libc |futex(ERESTARTNOINTR) | Blocked on V8 internal mutexes |Root Cause: V8 Property Descriptor Hash Table Loop
The main thread (Thread 1) was trapped in a tight V8 JIT-compiled loop doing a property descriptor lookup in a hash table. Disassembly:
The
jeat0x4687f05jumps back to0x4687ea1, creating a tight CPU-bound loop. The V8 engine is repeatedly probing a property descriptor hash table (27 entries / 99 capacity) without ever yielding to the event loop.Key Differences from macOS Report
| Aspect | Issue #18532 (macOS) | This Report (Linux) |
|--------|---------------------|---------------------|
| Network | Connections open | Zero TCP connections |
| Binary | Bun runtime | Node.js (statically compiled) |
| CPU | 100% single core | 54% (scheduler dependent) |
| Instruction | Stripped offsets only | Full x86_64 disassembly |
Conclusion
The main thread enters a V8-internal infinite loop in JIT-compiled code. All worker threads are properly idle on futex. The event loop thread is properly in
epoll_pwait2. But because the main thread never returns from its JIT function, the event loop never gets a chance to process I/O events, timers, or signals (explaining why SIGTERM is ignored — the signal handler can't run).This is a V8 engine-level bug (or V8 JIT miscompilation) rather than a JavaScript-level infinite loop, since the stuck code is in V8's internal property descriptor machinery, not user JS code.
New Reproduction: Post-MCP-Response CPU Spin with Full Forensics
Adding a detailed reproduction case to this issue. Filed separately as #36729 but this is the same class of bug.
Environment
| Component | Value |
|-----------|-------|
| Claude Code | Latest (updated 2026-03-19) |
| OS | macOS (Apple Silicon, Darwin 25.3.0) |
| Model | claude-opus-4-6 (1M context) |
| MCP Servers | Custom Python MCP server (isaac-mcp) + excel-stdio |
Reproduction
report_proposals(filter="read")returns 2758 bytes of valid JSONForensic Evidence (JSONL Transcript Analysis)
The session transcript (
6b7a00f4-8d44-4adc-8e22-495502c64cbe) proves exactly where the failure occurs:Key proof: The MCP tool result IS in the transcript (line 68) — the data was received by Claude Code. The runtime failed during response generation, not during tool execution.
Process State When Hung
Two zombie children never reaped:
Ctrl-C and Esc completely non-functional. Only
kill -9terminated it.Estimated API Payload at Time of Hang
| Component | Size |
|-----------|------|
| System prompt (governance rules chain) | ~123 KB |
| Tool definitions (~135 tools across 2 MCP servers + built-ins) | ~135 KB |
| Conversation history (23 tool results across 3 batches) | ~93 KB |
| System reminders (plan mode, compliance, per-turn injections) | ~20-30 KB |
| Total estimated API payload | ~580-600 KB |
Well within 1M context window. The triggering response was 2758 bytes — trivially small.
What This Adds to #18532
Narrowed Search Space
The bug is in Claude Code's response generation pipeline — the code path between "tool result received" and "assistant message produced." The tool result was valid. The payload was within limits. The process was running (R+), not sleeping (S). Something in this code path enters an infinite loop under certain conditions.
Cross-reference: #36729 (my detailed report), #34565 (different bug — tool never returns), #36469 (different bug — oversized response)
I had to downgrade to 2.1.79 to stop claude code freezing my macOS
Edit: No downgrading worked for me sadly! it was still eating up my ram.
Edit2: I found out the issue is not solely with claude code, i have a lot of extensions in vs code, i uninstalled all of them and clean installed claude code latest version (2.1.85) and other essentials. Seems the issue is no more! The CPU is happy now
Refinement on the "main thread infinite loop" diagnosis: a fresh 10s system spindump on 2.1.126 (macOS 26.4.1, M5, 32 GB) shows all 1000 main-thread samples in
__posix_spawn → __socketpair → setsockopt → __close_nocancel— a syscall spawn loop, not a JS/V8 tight loop.Kernel turnstile waits explicitly name
pgrepchildren. The bug appears to be thetree-killrecursivepgrepstorm tracked in #52253, not a JS-level infinite loop. Forensic detail: #52253 comment. Reproduces reliably with the 4-step repro in #55609.Hi @smconner — wanted to note a possibly-related observation, though I want to be careful: I don't have proof these are the same bug, just a pattern worth flagging for anyone debugging this thread.
In the context-window-misdetection cluster (#55504, #47019, #35677, #34143, #43989, #42375, #34332), Claude Code Desktop on Max plan with Opus 4.7 [1m] is treating the served context as ~200K (not the advertised 1M), which causes auto-compaction to fire at ~190K and cascade every single turn thereafter. In one 30-day window on my machine the cascade fired 602 times across 153 sessions, with one session compacting 29 times.
When a user issues
/compactmanually past ~350K in this cascade state, the slash command registers in~/.claude/cache/compaction-log.jsonlwithtrigger: "manual"but the displayed context bar never moves and the session never returns to a usable state — it appears the manual/compactis queued behind the auto-cascade and never observably finishes. The runtime stays busy but the UI thread becomes effectively unresponsive for compaction purposes.I can't confirm whether that's the same freeze you're describing in v2.1.9 (your case is platform:macos and predates the 1M variant), but the symptom shape — "Claude Code consumes CPU on the main thread and becomes unresponsive during/around compaction" — is similar enough that it might be worth checking if the auto-compact-cascade scenario is part of the freeze-cluster's root cause. If the compaction work item is non-cancellable and a second one stacks behind a first one that hasn't finished, that would explain both your hang and my "manual /compact never completes."
Comprehensive 30-day evidence on the primary tracker #55504: https://github.com/anthropics/claude-code/issues/55504#issuecomment-4525687708 — happy to share raw JSONL if it's useful for cross-referencing your repro.
Thank you for the very thorough freeze report — the main-thread-stuck framing is exactly the kind of detail that lets people connect dots across related bugs.
Consolidating from my duplicate #68931 — adding macOS ARM64 sampling evidence that this is still present in a much newer build.
Env: Claude Code v2.1.177, macOS 15.7.3 (24G419), Apple Silicon (ARM64).
Symptom: three idle
claudesessions simultaneously pinned at ~99.9% CPU with no prompt running; accumulated hours of CPU while idle; terminal became laggy / couldn't accept input.Sampling (5×
/usr/bin/sampleon the worst pid, byte-for-byte identical → stable repeating state):com.apple.main-thread) sits in the event loop withkevent64returning immediately and re-arming in a tight loop (varied return offsets) rather than blocking — the macOS equivalent of thesetImmediate/non-blocking-poll busy-wait described in #17148 / #10493.Recovery (same as #21006): opening a new Claude session knocked the stuck session out of the spin without killing it — the stuck PIDs immediately dropped to ~0.1% CPU and stopped accumulating CPU time. So a terminal state change (SIGWINCH / focus / foreground-pgrp) seems to break the loop.
Full 5 sample captures (no sensitive data —
sampleredacts user paths to/Users/USER/*, binary is stripped):https://gist.github.com/echo-layker/1d38915d4cbdfa27de2672a21cc22f21
Aggravating factor: multiple long-lived idle sessions accumulating in the background made it far more frequent/impactful (cf. #11122).
Mac freezes / 100% CPU under coding agents is a class of failure we see a lot in multi-agent fleets (not only Claude Code).
If anyone lands here mid-incident on macOS:
Free kit first. If you have one repeated production failure pattern that costs real hours/tokens and want a fixed paid diagnostic ($499, one pattern, written root-cause + which gates to install), public-safe intake: paid hardening inquiry or the Diagnostic Payment Link in the repo README.
Not affiliated with Anthropic — sharing because the freeze + infinite-tool-retry combo is the same class of reliability work we ship.