You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the Python MCP server process restarts (e.g., via /mcp reconnect in Claude Code), Unity's StdioBridgeHost socket listener enters a zombie state — it accepts new TCP connections on port 6404 but never processes the incoming command data. The Unity Editor UI appears completely normal ("Session Active", green dot), and the server successfully connects and sends data, but Unity never responds.
Restarting the session from the Unity side (End Session + Start Session) immediately fixes the issue.
Reproduction Steps
Open a Unity project with MCP for Unity running (stdio transport, port 6404)
Connect from Claude Code — verify tool calls work
Run /mcp in Claude Code to reconnect (this kills and restarts the Python server process)
Immediately make tool calls — they all timeout
Observed Behavior
Server discovers Unity on port 6404 (correct)
TCP connections succeed (connect took 0.002s)
Data sends succeed (sendall took 0.000s)
Unity never responds — every command hits the 1-second socket timeout
All 6 retry attempts fail for every command
This persists indefinitely (tested for several minutes)
Unity Editor UI shows "Session Active" with green dot, no errors in Console
Server Logs
14:10:29 [INFO] send_command_with_retry START command=get_project_info
14:10:29 [INFO] Discovered 1 Unity instances
14:10:29 [INFO] connect took 0.001s command=get_project_info
14:10:29 [INFO] sendall took 0.000s command=get_project_info
14:10:59 [WARN] Socket timeout during framed receive
14:10:59 [WARN] Unity communication attempt 1 failed: Timeout receiving Unity response
... (repeats through attempt 6, every command)
Key detail: the first timeout on get_project_info takes 30 seconds (14:10:29 → 14:10:59), suggesting a longer initial timeout. Subsequent retries timeout at 1 second each.
Expected Behavior
When the Python server restarts and opens new TCP connections to the same port, Unity should process commands from the new connections normally.
Root Cause Hypothesis
When the old Python server process dies, its TCP connections to Unity's socket listener are severed. The StdioBridgeHost may not properly clean up the old connection state, so when new connections arrive on the same port, the accept/read loop is stuck or blocked on the stale connection. The socket is listening (connections succeed) but the command dispatcher never reads from the new connections.
Resolution
End Session + Start Session in the Unity MCP window immediately fixes it, confirming the issue is in Unity-side socket state management.
telemetry_ping appears to succeed during the failure because it's handled server-side without a Unity round-trip.
Reproduced on 2026-02-19. A previous session showed a different failure mode ("Discovered 0 Unity instances") which may be a separate intermittent issue or the same underlying cause manifesting differently.
Summary
When the Python MCP server process restarts (e.g., via
/mcpreconnect in Claude Code), Unity'sStdioBridgeHostsocket listener enters a zombie state — it accepts new TCP connections on port 6404 but never processes the incoming command data. The Unity Editor UI appears completely normal ("Session Active", green dot), and the server successfully connects and sends data, but Unity never responds.Restarting the session from the Unity side (End Session + Start Session) immediately fixes the issue.
Reproduction Steps
/mcpin Claude Code to reconnect (this kills and restarts the Python server process)Observed Behavior
connect took 0.002s)sendall took 0.000s)Server Logs
Key detail: the first timeout on
get_project_infotakes 30 seconds (14:10:29 → 14:10:59), suggesting a longer initial timeout. Subsequent retries timeout at 1 second each.Expected Behavior
When the Python server restarts and opens new TCP connections to the same port, Unity should process commands from the new connections normally.
Root Cause Hypothesis
When the old Python server process dies, its TCP connections to Unity's socket listener are severed. The
StdioBridgeHostmay not properly clean up the old connection state, so when new connections arrive on the same port, the accept/read loop is stuck or blocked on the stale connection. The socket is listening (connections succeed) but the command dispatcher never reads from the new connections.Resolution
End Session + Start Session in the Unity MCP window immediately fixes it, confirming the issue is in Unity-side socket state management.
Environment
Notes
StdioBridgeHostare untouched by that PR.telemetry_pingappears to succeed during the failure because it's handled server-side without a Unity round-trip.