Skip to content

Handle BC MCP warm-up timeouts and client disconnects gracefully - #861

Draft
Sun Haoran (haoranpb) with Copilot wants to merge 1 commit into
mainfrom
copilot/investigate-bc-mcp-gateway-issues
Draft

Handle BC MCP warm-up timeouts and client disconnects gracefully#861
Sun Haoran (haoranpb) with Copilot wants to merge 1 commit into
mainfrom
copilot/investigate-bc-mcp-gateway-issues

Conversation

Copilot AI commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Successful Data Query evaluations emitted warm-up warnings and client-disconnect tracebacks. The gateway also mislabeled upstream socket failures after response headers as client disconnects.

  • Bounded warm-up

    • Share deadlines across handshake requests, blocking reads, and retry sleeps.
    • Log transient failures at INFO with handshake stage and elapsed time; warn when the budget expires.
    • Preserve unexpected-error diagnostics.
  • Accurate disconnect handling

    • Handle client resets and broken pipes throughout the HTTP lifecycle at DEBUG.
    • Keep upstream failures visible; close incomplete responses without sending a second response.
  • Regression coverage

    • Cover retry recovery, deadline exhaustion, stalled/trickled responses, client disconnects, and upstream failure reporting.

OS DNS resolution remains outside strict deadline enforcement.

Co-authored-by: haoranpb <27280733+haoranpb@users.noreply.github.com>
Comment thread tests/test_mcp_gateway.py
self.connection.sendall(b" ")
else:
assert self.connection.recv(1) == b""
except (ConnectionResetError, BrokenPipeError):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants