Excessive node subprocess spawning causes system-wide crashes on macOS
Summary
Running multiple Claude Code sessions (2-4) causes system-wide application crashes on macOS due to excessive node subprocess spawning that overwhelms macOS security subsystems.
Environment
- OS: macOS 26.2 (Build 25C56) - Darwin 25.2.0
- Hardware: Mac Mini M4 Pro (Mac16,11), 14 cores, 64GB RAM
- Claude Code version: Latest (as of 2026-01-20)
Symptoms
When running 2-4 Claude Code terminal sessions simultaneously:
- All terminal emulators (iTerm2, WezTerm) suddenly close
- Chrome tabs show "crashed" error (but window stays open)
- Electron apps (e.g., LM Studio) UI goes black
- GPU-accelerated applications fail across the board
Root Cause Analysis
Investigated via macOS unified logs. Found:
1. Excessive node process spawning
$ log show --last 5m | grep 'AppleSystemPolicy.*node' | wc -l
4164
That's ~14 node processes per second being spawned. In one incident, 1,168 node processes spawned in ONE MINUTE.
Log entries show rapid sequential PIDs:
kernel: (AppleSystemPolicy) ASP: Unable to apply provenance sandbox: 268451845, 897, /Users/.../.nvm/versions/node/v22.16.0/bin/node
kernel: (AppleSystemPolicy) ASP: Unable to apply provenance sandbox: 268451845, 898, /Users/.../.nvm/versions/node/v22.16.0/bin/node
kernel: (AppleSystemPolicy) ASP: Unable to apply provenance sandbox: 268451845, 899, /Users/.../.nvm/versions/node/v22.16.0/bin/node
... (continues rapidly)
2. IOSurface (GPU) failures cascade
The node spawn flood overwhelms the Mach port system, causing IOSurface failures:
$ log show --last 15m | grep -c 'IOSurface.*not found'
34355
Over 34,000 IOSurface errors in 15 minutes (~38/second). These errors:
kernel: (IOSurface) SID: 0x0 task: <private> buffer: 0x0 buffer->fClientTask = 0x0 not found
3. Mach port system failure
Chrome's crash handler itself crashes due to Mach port exhaustion:
chrome_crashpad_handler: [FATAL:...exception_handler_server.cc:76] Check failed: kr == KERN_SUCCESS. mach_port_request_notification: (os/kern) invalid capability (20)
Reproduction
- Open 2-4 Claude Code sessions in separate terminals
- Have each session perform operations (especially those involving tool calls, Bash commands, or parallel operations)
- System will crash within minutes
Impact
- Severity: High - causes loss of work across ALL applications
- Data loss: Unsaved work in any application is lost
- Frequency: Reproducible, happened 3 times in one evening
Suggested Fix
Investigate why Claude Code spawns so many short-lived node child processes. The spawn rate of 14-20 processes/second seems excessive for normal operation. Consider:
- Reusing node processes instead of spawning new ones
- Rate-limiting subprocess creation
- Using worker threads instead of child processes where possible
Workaround
Limit to 1-2 Claude Code sessions when doing heavy work.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗