Skip to content

Client requests hang forever if server dies #332

Closed
@mroch

Description

@mroch

Describe the bug
If the stdio streams close before responding to a request (i.e. the server dies), the pending request waits forever (or for the read timeout) instead of erroring.

To Reproduce
Steps to reproduce the behavior:

  1. await session.initialize() or some other request
  2. in the server request handler, exit instead of responding to the request
  3. on the client, the await never resolves so the client hangs indefinitely

Expected behavior
The typescript SDK makes the pending requests return a -32000 "Connection closed" in this case

https://github.com/modelcontextprotocol/typescript-sdk/blob/0fa2397174eba309b54575294d56754c52b13a65/src/shared/protocol.ts#L260-L263

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions