Skip to content

fix: propagate stdio process exit during initialization#960

Draft
DragonFSKY wants to merge 1 commit into
modelcontextprotocol:mainfrom
DragonFSKY:fix/959-stdio-process-exit
Draft

fix: propagate stdio process exit during initialization#960
DragonFSKY wants to merge 1 commit into
modelcontextprotocol:mainfrom
DragonFSKY:fix/959-stdio-process-exit

Conversation

@DragonFSKY
Copy link
Copy Markdown

Summary

  • Detect unexpected stdio process exit after the child process has started.
  • Propagate that stdio exit to an in-progress initialization instead of waiting for the request timeout.
  • Preserve generic transport exception behavior and add regression coverage for a stdio server that exits before initialize.

Fixes #959

Notes

This keeps the scope limited to process exits that happen after ProcessBuilder.start() succeeds and before initialization completes. It does not change startup failures or normal stdio shutdown behavior.

A stdio-specific McpStdioServerProcessExitException is used so this initialization fast-fail path does not apply to generic transport exceptions from other transports.

Test Plan

  • ./mvnw -pl mcp-core,mcp-test spring-javaformat:apply
  • ./mvnw -pl mcp-core test
  • ./mvnw -pl mcp-test -am test -Dtest=StdioMcpClientInitializationFailureTests -Dsurefire.failIfNoSpecifiedTests=false
  • ./mvnw -pl mcp-test -am test -Dtest=HttpClientStreamableHttpAsyncClientResiliencyTests#testPing -Dsurefire.failIfNoSpecifiedTests=false
  • ./mvnw clean test (local run reached mcp-test and failed in HTTP/Testcontainers resiliency/security integration tests; I did not count the full suite as passing)

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.

StdioClientTransport does not propagate unexpected child process exit during initialization

1 participant