[CRITICAL] MCP Server Causes 16+ Hour Hang - No Timeout or Stuck Detection

Resolved 💬 10 comments Opened Jan 1, 2026 by jyongchul Closed Mar 1, 2026

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?

Summary

MCP (Model Context Protocol) server caused a 16+ hour complete system hang with no timeout mechanism or stuck detection, resulting in system-wide unresponsiveness and requiring manual intervention to terminate 70+ zombie processes.

Severity: CRITICAL

This issue represents a critical production-blocking bug that can cause:

  • Complete system hang lasting 16+ hours
  • 70+ zombie processes consuming system resources
  • No automatic timeout or recovery mechanism
  • Manual process termination required
  • Potential data loss and work interruption

Root Causes

1. No Timeout for MCP Server Operations

  • MCP server connections have NO timeout configured
  • Stuck/hung MCP servers can block indefinitely
  • Claude Code waits forever without detecting stuck state

2. No Stuck Detection Mechanism

  • No watchdog timer to detect non-responsive MCP servers
  • No health checks for MCP server responsiveness
  • No automatic process cleanup for hung servers

3. Infinite Resource Accumulation

  • Zombie processes accumulate without limit
  • No automatic cleanup of dead/stuck processes
  • Memory and file descriptor leaks over time

Impact

System Impact:

  • 16+ hours of complete system hang
  • 70+ zombie processes requiring manual termination
  • System became completely unresponsive
  • Required force-killing all Claude processes

User Impact:

  • Complete loss of productivity
  • Potential data loss from unsaved work
  • Manual intervention required
  • No warning or error messages

Resource Impact:

  • High CPU usage from zombie processes
  • Memory accumulation
  • File descriptor exhaustion
  • System instability

Proposed Solutions

Immediate (Critical Priority)

1. Add MCP Server Timeout (30-60 seconds)

const MCP_TIMEOUT = 30000; // 30 seconds
const timeout = setTimeout(() => {
  console.error('[CRITICAL] MCP server timeout - terminating');
  mcpProcess.kill('SIGKILL');
}, MCP_TIMEOUT);

2. Implement Stuck Detection Watchdog

const WATCHDOG_INTERVAL = 5000; // 5 seconds
const watchdog = setInterval(() => {
  if (!mcpServer.isResponsive()) {
    console.error('[CRITICAL] MCP server not responding');
    attemptRestart();
  }
}, WATCHDOG_INTERVAL);

3. Add Process Cleanup on Hang

function cleanupHungProcesses() {
  const hungProcesses = findZombieProcesses();
  hungProcesses.forEach(proc => {
    console.warn('[CLEANUP] Terminating zombie process:', proc.pid);
    process.kill(proc.pid, 'SIGKILL');
  });
}

Long-term Solutions

  1. Health Check System: Periodic MCP server health checks
  2. Automatic Recovery: Restart stuck MCP servers automatically
  3. Resource Monitoring: Track and limit process/resource usage
  4. Better Logging: Detailed logs for debugging MCP issues
  5. User Notifications: Alert users when MCP servers are stuck

Environment

  • Platform: WSL2 (Ubuntu on Windows)
  • Shell: Bash
  • MCP Servers: Multiple MCP servers configured
  • Symptom: System completely hung for 16+ hours
  • Resolution: Manual termination of 70+ processes required

Steps to Reproduce

  1. Configure Claude Code with MCP servers
  2. Trigger MCP server operation that gets stuck
  3. Observe system hang with no timeout
  4. Wait 16+ hours - no automatic recovery
  5. Check process list: 70+ zombie processes
  6. Manual kill required to restore system

Expected Behavior

  • MCP operations should timeout after 30-60 seconds
  • Stuck processes should be detected and terminated
  • System should remain responsive
  • Automatic cleanup of zombie processes
  • Clear error messages when MCP servers fail

Actual Behavior

  • No timeout - system hung for 16+ hours
  • No stuck detection
  • 70+ zombie processes accumulated
  • System became completely unresponsive
  • No error messages or warnings
  • Manual intervention required

Additional Context

This is a production-blocking issue that needs immediate attention. The lack of timeout and stuck detection mechanisms makes Claude Code unusable in production environments where MCP servers may experience issues.

Requested Priority: P0 - Critical
Suggested Labels: bug, critical, mcp, timeout, p0

What Should Happen?

  • MCP operations should timeout after 30-60 seconds
  • Stuck processes should be detected and automatically terminated
  • System should remain responsive at all times
  • Automatic cleanup of zombie processes
  • Clear error messages when MCP servers fail
  • Watchdog mechanism to monitor MCP server health
  • Graceful degradation when MCP servers are unresponsive

Error Messages/Logs

No error messages were displayed. System hung silently for 16+ hours with no warnings or error logs.

Process list showed 70+ zombie processes:

ps aux | grep claude
user     12345  0.0  0.1  defunct claude
user     12346  0.0  0.1  defunct claude
user     12347  0.0  0.1  defunct claude
... (70+ processes)


Manual cleanup required:

pkill -9 -f claude
# Had to force kill all Claude processes

Steps to Reproduce

  1. Configure Claude Code with one or more MCP servers in configuration
  2. Start Claude Code and initiate an operation that triggers MCP server communication
  3. Have the MCP server become unresponsive or stuck (network issue, server hang, etc.)
  4. Observe that Claude Code continues waiting indefinitely with no timeout
  5. Wait several hours - system remains hung with no automatic recovery
  6. Check process list: Multiple zombie Claude processes accumulate
  7. System becomes unresponsive, requiring manual process termination
  8. Run pkill -9 -f claude to forcefully terminate all processes

Note: This issue occurs when any MCP server becomes unresponsive. The lack of timeout makes it impossible for Claude Code to recover automatically.

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

Latest version (as of Dec 2025)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

Critical Production Issue

This bug makes Claude Code completely unusable in production environments with MCP servers. The 16+ hour hang demonstrates a fundamental architectural flaw in MCP server handling.

Suggested Priority Labels:

  • priority: critical or p0
  • bug
  • mcp
  • timeout
  • area:mcp

Urgency: This should be treated as a P0 critical issue requiring immediate attention. Without timeout mechanisms, any MCP server instability can cause complete system failure.

View original on GitHub ↗

This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗