the context.RequestAborted not reliable in HandleSseRequestAsync
まだ誰も着手していません。
評価
調査の方向性
HandleSseRequestAsync から開始し、RunSessionAsync がそれに関連付けられたキャンセル トークンをどのように使用しているかを追跡します。MCP Inspector で Connect をクリックしてからすぐに Ctrl+F4 を押して切断を再現し、その後、リクエストのキャンセル パスが実行されるかどうかを確認します。異常な切断によってセッションがキャンセルされ、RunSessionAsync が無期限に待機しないことを確認できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
the Request object will disposed when the connection was not normal disconnected, and the context.RequestAborted has two situations.
1.the context RequestAboated will disposed ,but will not raise registe event notify it was cancelled;because it just disposed.
2.the request will disposed, but the ReuqestAborted not changed,it stay not cancelled state.
the HandleSseRequestAsync method use RequestAborted to created a token source, when the request was disposed this token source will always be not cancelled, because it will not raise Registe event or RequestAborted will always not be cancelled, then the await RunSessionAsync will forever wait for next request.
using CancellationTokenSource sseCts = CancellationTokenSource.CreateLinkedTokenSource(context.RequestAborted, <hostApplicationLifetime>P.ApplicationStopping);
To Reproduce
Steps to reproduce the behavior:
just use mcp inspector ,click the "connect" button ,then quickly use ctrl+F4 to close the webpage,
or use RunSessionHandler to debug then wait it timeout.
Expected behavior
the cancellationToken must to become canceled, even the request was not normal disconnected.
Logs
Additional context
i have not better idea for this, maybe can use context.Reponse.OnCompleted(()=>sseCts.Cancel()) to fix the problem.
- 主要言語
- C#
- スター
- 4.5k
- フォーク
- 814
- 平均マージ
- 9日 19時間
- マージ済み PR(30日)
- 4
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/csharp-sdk のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
modelcontextprotocol/csharp-sdk#1867 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
modelcontextprotocol/csharp-sdk#1840 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
modelcontextprotocol/csharp-sdk#1836 ·
-
enhancement needs confirmation
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
modelcontextprotocol/csharp-sdk#678 · コメント 1 件 ·
-
enhancement needs confirmation P3 ready for work
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modelcontextprotocol/csharp-sdk#515 · コメント 6 件 · リアクション 3 件 ·
modelcontextprotocol/csharp-sdk の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
bug needs response
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
Adyen/adyen-dotnet-api-library#1869 ·
-
Status: Needs Triage Type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
bug effort:S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
nightscout/nocturne#1602 ·