Skip to content

fix: retain streamable HTTP session on response write failure#972

Open
DragonFSKY wants to merge 1 commit into
modelcontextprotocol:mainfrom
DragonFSKY:fix/952-streamable-session-retained
Open

fix: retain streamable HTTP session on response write failure#972
DragonFSKY wants to merge 1 commit into
modelcontextprotocol:mainfrom
DragonFSKY:fix/952-streamable-session-retained

Conversation

@DragonFSKY
Copy link
Copy Markdown

Fixes #952.

Summary

  • Keep the MCP session registered when a request-specific streamable HTTP response write fails.
  • Continue completing the failed request async context without treating the write failure as an explicit session termination.
  • Add a regression test that simulates PrintWriter.checkError() after an SSE response write and verifies a subsequent request using the same session id does not return 404.

Verification

  • ./mvnw -pl mcp-test -am -Dtest=HttpServletStreamableSessionFailureTests -Dsurefire.failIfNoSpecifiedTests=false test
  • ./mvnw -pl mcp-test -am -Dtest=HttpServletStreamableSessionFailureTests,HttpServletStreamableSyncServerTests,HttpServletStreamableAsyncServerTests,HttpServletStreamableIntegrationTests -Dsurefire.failIfNoSpecifiedTests=false test
  • ./mvnw -pl mcp-core,mcp-test -am spring-javaformat:validate
  • git diff --check

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.

HttpServletStreamableServerTransportProvider removes session on non-fatal failure

1 participant