Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

handleAutomaticTaskPolling ignores AbortSignal; cancelled requests poll indefinitely

オープン 初心者向け
#2,018 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
typescript
領域
api, backend

調査の方向性

packages/server/src/server/mcp.ts の handleAutomaticTaskPolling から開始し、そのポーリングループを taskManager.ts の856行目付近にあるシグナルチェックと比較します。中止された ctx.mcpReq.signal によって、指定されたキャンセルエラーとともにポーリングが停止することを確認し、キャンセルされていないタスクのポーリングが引き続き完了または失敗に到達することを検証します。

索引モデルが issue の本文から書いたものです。

説明

potentially close
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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

modelcontextprotocol/typescript-sdk のほかの issue

modelcontextprotocol/typescript-sdk の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。