modelcontextprotocol / modelcontextprotocol/java-sdk
DefaultMcpTransportSession#closeGracefully leaks resources on incomplete DELETE response
@Kehrlann がすでに取り組んでいます。
2026年8月27日 から。
- 主要言語
- Java
- スター
- 3.7k
- フォーク
- 1.1k
- 平均マージ
- 1日 15時間
- マージ済み PR(30日)
- 9
説明
Bug description
When the MCP server is abnormal, the statement this.onClose.apply(this.sessionId.get()) in the closeGracefully method of DefaultMcpTransportSession.java throws an exception, so this.openConnections::dispose is never executed and may leak resources.
Environment
Java version: 21
mcp-bom: 0.11.3
Steps to reproduce
1、Create an McpSyncClient.
2、Execute client.initialize(); client.listTools();
3、Suspend the debugger at client.closeGracefully();
4、Make the MCP server unavailable.
5、Resume execution of client.closeGracefully();
Expected behavior
this.openConnections::dispose should always be executed.
Minimal Complete Reproducible example
McpSyncClient client = McpClient.sync(transport)
.requestTimeout(Duration.ofSeconds(10))
.build();
// Initialize connection
client.initialize();
// List available tools
ListToolsResult tools = client.listTools();
// Close client
client.closeGracefully();
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。