[BUG] Claude Code creates excessive SYN_SENT connections, exhausting router NAT table
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When running multiple parallel Claude Code instances (e.g., via agent loops like ralphy.sh), Claude Code creates hundreds of TCP connections to 34.36.57.103:443 (Google Cloud, presumably Anthropic served by Vertex?) that get stuck in SYN_SENT state. These connections accumulate without proper backoff, exhausting the router's NAT table and causing network outages for the entire household.
To be clear: I was running ralphy.sh with default settings (3 parallel claude code instances)
Environment Info
- Platform: macOS (darwin)
- CC Version: 2.1.12
- Network: Residential fiber (600Mbps) through consumer router
What Should Happen?
- Connection pooling to reuse existing connections
- Exponential backoff when connections fail
- Maximum concurrent connection limit
- Graceful handling when endpoint is unreachable
While part of the problem might be a residential router's lower NAT table limits, claude code still should handle rate limits to their own API better with some kind of exponential backoff, connection pools, etc.
Error Messages/Logs
- ~290 TCP connections stuck in `SYN_SENT` state to `34.36.57.103:443`
- All connections from Claude CLI processes (identified as `2.1.12` in lsof)
- Connections held for 75 seconds before timeout (macOS default `net.inet.tcp.keepinit`)
- New connection attempts made faster than old ones timeout
- Router NAT table exhausted, blocking all network traffic for all devices
- DNS queries fail, websites timeout, router admin UI inaccessible
$ lsof -i -n -P | grep SYN_SENT | awk '{print $1, $2}' | sort | uniq -c | sort -rn
176 2.1.12 8024
114 2.1.12 6015
$ netstat -an | grep "34.36.57.103" | head -5
tcp4 0 0 192.168.0.33.59658 34.36.57.103.443 SYN_SENT
tcp4 0 0 192.168.0.33.59659 34.36.57.103.443 SYN_SENT
tcp4 0 0 192.168.0.33.59900 34.36.57.103.443 SYN_SENT
...
Only fix: kill Claude processes and/or reboot router
Steps to Reproduce
- Run multiple parallel Claude Code agents (3+ instances)
- Let them run for 5-10 minutes
- Monitor connections with:
netstat -an | grep SYN_SENT | wc -l
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.12
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Warp
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗