Potential race condition in (*mcp.ClientSession).Close()
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
まず gopls/internal/cmd/mcp_test.go の TestMCPCommandLogging 周辺と gopls/internal/cmd/mcp.go を確認し、その後 go test -run ^TestMCPCommandLogging$ -count=100 golang.org/x/tools/gopls/internal/cmd を実行して flake を再現します。MCP クライアントの終了と子プロセスの終了処理の相互作用を追跡します。繰り返し実行してもクライアント接続がエラーなしで閉じられれば完了です。
索引モデルが issue の本文から書いたものです。
説明
We've experienced an increasing number of test flakes in the tests for our MCP server. There is an error when closing the connection at the end of the tests: "server is closing: EOF". We think there might be a bug in mcp causing a race between the active part of Close (which breaks the connection and terminates the child process) and the waiting part of close (which seems to observe an error from the terminated child without realizing that close itself was responsible). Alan began tracing the issue here: https://github.com/golang/go/issues/77336#issuecomment-4090756198
To Reproduce
The test is here: https://github.com/golang/tools/blob/36360cdf844bb2553617bdc496c8d972c7229e7d/gopls/internal/cmd/mcp_test.go#L109
Server code is here: https://github.com/golang/tools/blob/master/gopls/internal/cmd/mcp.go
Try to reproduce the failure locally by using -count=100:
go test -run ^TestMCPCommandLogging$ -count=100 golang.org/x/tools/gopls/internal/cmd
=== RUN TestMCPCommandLogging/trace.log
gopls: server is closing: EOF
mcp_test.go:156: closing MCP connection: exit status 2
Expected behavior
Client connection closes without error.
- 主要言語
- Go
- スター
- 5.4k
- フォーク
- 623
- 平均マージ
- 22時間 10分
- マージ済み PR(30日)
- 30
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/go-sdk のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
modelcontextprotocol/go-sdk#1557 ·
メンテナーはふだん 1 日以内に返信
-
Streamable HTTP (2026-07-28): tools/call with an out-of-range number in arguments fails because extractName decodes Arguments into any再び着手できるかも @beiryu が 10 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
modelcontextprotocol/go-sdk#1534 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Expose generic `SendNotification` on `ServerSession` for custom protocol extensions再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンneeds investigation
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
modelcontextprotocol/go-sdk#745 · コメント 13 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 18/100
modelcontextprotocol/go-sdk#1555 ·
メンテナーはふだん 1 日以内に返信
-
mcp: 2026-07-28 client runs elicitation and sampling handlers for standalone server requests再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
modelcontextprotocol/go-sdk#1552 ·
メンテナーはふだん 1 日以内に返信
modelcontextprotocol/go-sdk の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
apache/dubbo-admin#1659 ·
メンテナーはふだん 8 日以内に返信
-
taskmanager: a failed v1alpha1 backup leaves the partial backup behind対応中かも @arshil42 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100