claude-code - 💡(How to fix) Fix CLI freezes daily: silent TCP drop leaves process in kevent64 with zero API connections (macOS, university network) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45269Fetched 2026-04-09 08:09:18
View on GitHub
Comments
1
Participants
2
Timeline
9
Reactions
0
Timeline (top)
labeled ×5cross-referenced ×3commented ×1

Claude Code CLI often keeps spinning for an hour without any progress (no token exchanged etc)

Related: #24688, #33949, #37534, #32116

Root Cause

Claude Code CLI often keeps spinning for an hour without any progress (no token exchanged etc)

Related: #24688, #33949, #37534, #32116

Code Example

# Frozen process — no network connections
$ lsof -p 73304 -i TCP | grep "^2.1"
(empty)
RAW_BUFFERClick to expand / collapse

Summary

Claude Code CLI often keeps spinning for an hour without any progress (no token exchanged etc)

Related: #24688, #33949, #37534, #32116

Environment

  • macOS 26.3.1, ARM64 (Mac Studio)
  • Claude Code v2.1.92
  • University network with dynamic IP (DHCP/NAT): dyn-*.dyn.columbia.edu
  • MCP servers: claude-in-chrome, google_workspace

Diagnosis

Captured diagnostics from a frozen session (PID 73304) while a working session (PID 83840) ran on the same machine.

The frozen process has zero TCP connections — the API connection silently dropped:

# Frozen process — no network connections
$ lsof -p 73304 -i TCP | grep "^2.1"
(empty)

Process sampling (10s, 1ms interval) shows 94% of time in kevent64 — idle-waiting for I/O that will never arrive on a dead connection.

The freeze occurred during a subagent API call ("Cerebrating… 55m 30s").

Likely mechanism

  1. Session is mid-API-call
  2. Network reassigns IP or NAT entry expires
  3. TCP connection silently drops (no RST/FIN)
  4. No request timeout or TCP keepalive detects the dead connection
  5. Process waits forever

🤖 Generated with Claude Code

extent analysis

TL;DR

Implementing a request timeout or TCP keepalive mechanism can likely resolve the issue of Claude Code CLI freezing due to silently dropped TCP connections.

Guidance

  • Investigate the API call ("Cerebrating… 55m 30s") to determine if a request timeout can be implemented to detect and handle dead connections.
  • Consider configuring TCP keepalive settings to periodically send probes and detect inactive connections.
  • Review the network configuration to understand the dynamics of IP reassignment and NAT entry expiration, which may contribute to the silent dropping of TCP connections.
  • Analyze the process sampling data to confirm that the issue is indeed related to idle-waiting for I/O on a dead connection.

Example

No specific code snippet can be provided without more context, but an example of setting a request timeout in a hypothetical API client might look like:

import requests

# Set a timeout of 30 minutes
timeout = 1800
try:
    response = requests.get('https://example.com/api', timeout=timeout)
except requests.Timeout:
    # Handle the timeout exception
    print("Request timed out")

Notes

The effectiveness of the proposed solution depends on the specific implementation details of the Claude Code CLI and its underlying network architecture. Further investigation may be necessary to determine the optimal approach.

Recommendation

Apply a workaround by implementing a request timeout or TCP keepalive mechanism, as this is likely to mitigate the issue of silently dropped TCP connections without requiring a version upgrade.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING