Skip to content

fix(server): cancel mapped request jobs when closing transport - #923

Open
mikemikimike wants to merge 1 commit into
modelcontextprotocol:mainfrom
mikemikimike:fix/922-cancel-streamable-http-get
Open

fix(server): cancel mapped request jobs when closing transport#923
mikemikimike wants to merge 1 commit into
modelcontextprotocol:mainfrom
mikemikimike:fix/922-cancel-streamable-http-get

Conversation

@mikemikimike

Copy link
Copy Markdown

Fixes #922

Summary

  • Cancel the coroutine job associated with each mapped Streamable HTTP request when the transport closes.
  • Cancel replaced standalone GET stream jobs and explicitly closed SSE stream jobs as well.
  • Preserve the current caller job so stateless request cleanup can finish normally.
  • Add a regression test proving that closing the transport cancels a standalone GET SSE handler.

Test context

All Gradle commands were run in eclipse-temurin:21-jdk because the host default JDK is 8.

  • :kotlin-sdk-server:jvmTest — passed, 229 tests, 0 failures, 0 errors.
  • :kotlin-sdk-server:ktlintCheck — passed.
  • :kotlin-sdk-server:detekt — passed.
  • :kotlin-sdk-server:apiCheck — passed across the configured JVM, JS, and native API targets.
  • :kotlin-sdk-server:jvmApiBuild — passed.
  • git diff --check — passed.

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.

Stateful StreamableHttpServerTransport leaks the standalone GET SSE stream on session close

1 participant