Correctness: No child process death detection for MCP servers #80

Open
opened 2026-05-11 13:48:50 +00:00 by thabeta · 0 comments
Owner

Severity: High

Location

crates/hero_aibroker_lib/src/mcp.rsMcpServer

Finding

MCP servers are spawned as child processes but there is no mechanism to detect if they crash or exit:

  • No SIGCHLD handler or child.try_wait() polling
  • McpManager has no health check loop for server liveness
  • Dead MCP servers remain in the tools_cache indefinitely
  • Tool discovery returns tools from dead servers

Impact

  • Tools from crashed MCP servers appear available but fail on invocation
  • No automatic restart of crashed MCP servers
  • Silent degradation of tool availability

Recommendation

  • Spawn a background task per MCP server that wait()s on the child
  • Implement periodic health checks (ping via JSON-RPC)
  • Auto-restart with backoff on unexpected exit
  • Remove tools from cache when server dies
## Severity: High ## Location `crates/hero_aibroker_lib/src/mcp.rs` — `McpServer` ## Finding MCP servers are spawned as child processes but there is no mechanism to detect if they crash or exit: - No `SIGCHLD` handler or `child.try_wait()` polling - `McpManager` has no health check loop for server liveness - Dead MCP servers remain in the `tools_cache` indefinitely - Tool discovery returns tools from dead servers ## Impact - Tools from crashed MCP servers appear available but fail on invocation - No automatic restart of crashed MCP servers - Silent degradation of tool availability ## Recommendation - Spawn a background task per MCP server that `wait()`s on the child - Implement periodic health checks (ping via JSON-RPC) - Auto-restart with backoff on unexpected exit - Remove tools from cache when server dies
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_aibroker#80
No description provided.