handleAutomaticTaskPolling ignores AbortSignal; cancelled requests poll indefinitely
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 74/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- typescript
調査の方向性
packages/server/src/server/mcp.ts の handleAutomaticTaskPolling から開始し、そのポーリングループを taskManager.ts の856行目付近にあるシグナルチェックと比較します。中止された ctx.mcpReq.signal によって、指定されたキャンセルエラーとともにポーリングが停止することを確認し、キャンセルされていないタスクのポーリングが引き続き完了または失敗に到達することを検証します。
索引モデルが issue の本文から書いたものです。
説明
Initial Checks
- Using the latest version of MCP TypeScript SDK
- Searched existing issues
Description
In packages/server/src/server/mcp.ts, handleAutomaticTaskPolling contains a while loop (lines 328-335) that polls a task store until completion. The loop never checks ctx.mcpReq.signal.aborted. If the client cancels the request, the poll loop continues consuming server resources indefinitely.
while (task.status !== 'completed' && task.status !== 'failed' && task.status !== 'cancelled') {
await new Promise(resolve => setTimeout(resolve, pollInterval));
const updatedTask = await ctx.task.store.getTask(taskId);
// ...
}
The taskManager.ts implementation of the same pattern correctly checks the signal (line 856):
if (signal.aborted) {
resolver(new ProtocolError(ProtocolErrorCode.InternalError, 'Task cancelled or completed'));
break;
}
Impact
On multi-tenant servers, a single cancelled long-running tool leaks a polling loop per cancelled request. Over time this accumulates.
Suggested fix
while (task.status !== 'completed' && task.status !== 'failed' && task.status !== 'cancelled') {
if (ctx.mcpReq.signal.aborted) {
throw new ProtocolError(ProtocolErrorCode.RequestCancelled, 'Request cancelled during task polling');
}
await new Promise(resolve => setTimeout(resolve, pollInterval));
// ...
}
- 主要言語
- TypeScript
- スター
- 13.4k
- フォーク
- 2.2k
- 平均マージ
- 5日 3時間
- マージ済み PR(30日)
- 4
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/typescript-sdk のほかの issue
-
v1 v2
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
modelcontextprotocol/typescript-sdk#2867 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Client drops `_meta` from `input_required` results when `allowInputRequired: true` (2026-07-28)オープンv2
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
modelcontextprotocol/typescript-sdk#2861 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
v1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
modelcontextprotocol/typescript-sdk#2854 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
v1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
modelcontextprotocol/typescript-sdk#2843 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Auth metadata discovery: fallback URL built on resource host instead of authorization-server hostオープンv1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
modelcontextprotocol/typescript-sdk#2784 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
modelcontextprotocol/typescript-sdk の issue をすべて見る
似ている issue
-
check:passed streams:add
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
Fission-AI/OpenSpec#1986 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
nestjs/docs.nestjs.com#3554 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
publicodes/publicodes#868 ·
-
namespace operations
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
EclipseFdn/open-vsx.org#13488 ·
メンテナーはふだん 2 日以内に返信