[BUG] Process spins at 100% CPU after terminal disconnect (macOS)
Resolved 💬 3 comments Opened Jan 11, 2026 by mycrobe Closed Jan 15, 2026
Description
After a terminal disconnects (e.g., closing terminal window, laptop sleep), Claude Code keeps running at 100% CPU indefinitely instead of exiting gracefully. The process consumed 30+ hours of CPU time over ~2 days before I noticed and killed it.
Note: The process was NOT consuming API tokens - it appeared to be stuck in a local busy loop, not making API calls. The conversation had completed successfully before the terminal was closed.
Note: This was observed once and is not reproducible on demand. Filing for awareness in case others encounter the same issue.
Reproduction
- Start a Claude Code session in a terminal
- Complete a task (conversation ends naturally)
- Close the terminal window (or disconnect via sleep/SSH drop)
- Process continues running, spinning at 100% CPU
Evidence
$ ps aux | grep claude
mycrobe 92827 101.9 0.9 445612048 289376 ?? R Fri12PM 1804:13.31 claude
$ lsof -p 92827 | head -20
COMMAND PID USER FD TYPE ... NAME
node 92827 mycrobe cwd DIR ... /Users/mycrobe/tmp
node 92827 mycrobe 0 (revoked)
node 92827 mycrobe 1 (revoked)
node 92827 mycrobe 2 (revoked)
- stdin/stdout/stderr are "revoked" (terminal gone)
- Process is in R (running) state, not sleeping
- Regular
killdidn't work, requiredkill -9
Environment
- Claude Code Version: 2.1.2
- OS: macOS Darwin 24.6.0 (Sequoia)
- Node.js Version: v20.19.4
- Node Path: /opt/n/bin/node (via n version manager)
- Terminal: iTerm2 (window was closed)
Expected Behavior
When the terminal disconnects (SIGHUP or revoked FDs), Claude Code should detect this and exit cleanly.
Related Issues
- #11339 - 100% CPU in interactive mode (similar symptom, different trigger)
- #8570 - Process behavior on disconnect (process pauses vs spins)
- #11707 - Windows node.exe hangs after terminal close
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗