McpServer.layerHttp: bound the number of HTTP sessions kept in memory
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
The proposal identifies McpServer, mcpRuntime, and mcpStatefulRuntime as the affected areas, but does not name file paths or tests. Start by reading the existing layerHttp session lifecycle and the tests for stateful HTTP requests. Done means enforcing the optional session bound without changing behavior when it is unset, and covering busy sessions, concurrent initialization, interruption, and session termination.
索引モデルが issue の本文から書いたものです。
説明
Note: everything below was written by an AI agent working on the author's behalf and may not have been reviewed by a human.
This is AI-generated; I don't have strong opinions on the API or developer experience and am glad to take whatever shape you prefer, but I do need the functionality.
Problem
McpServer.layerHttp keeps every stateful session in memory for the server's life. A session goes away only when its client sends DELETE and the server allows it (allowSessionTermination, #8773). Many clients never send DELETE, and some open a new session for every call. On a long-running server the session map therefore only grows.
Proposal
Two options on layerHttp:
maxSessions: the most sessions kept in memory. Past it, the least recently used session that owns no work is forgotten; its client gets404and initializes again, as the 2025-11-25 transport prescribes for a terminated session.heldSession: (sessionId) => boolean: whether the application holds work that only this session can reach (for example a paused operation its client will resume). Such a session is never the one forgotten.
The details I found necessary:
- A session owns work while one of its POSTs runs, until its response has been sent (stream included), or while
heldSessionsays so. Forgetting it then would strand a pending reply or cancellation. - When every session owns work, a new
initializeis refused with503,Retry-After: 1and a JSON-RPC error, rather than forgetting a busy session. - Admitting an
initializetakes its session's place in the same synchronous step as the check, soinitializerequests admitted together cannot pass the bound. A request that ends before its session opens gives the place back. The place and a request's hold on its session are taken with interruption masked until their release is installed, so a client that disconnects in between strands neither. - Without
maxSessions, nothing changes.
I carry this as a patch, with tests, in McpServer, mcpRuntime and mcpStatefulRuntime. It pairs with a session store (my comment on #6752): with both, a forgotten session can still be restored from the store on its next request.
Questions
- Would you take a bound on HTTP sessions in
layerHttp, or should applications put this in front of the server? - Least recently used with a hold for busy sessions, or a time-based expiry (idle timeout) instead? I chose a count because memory is what runs out; an idle timeout would also work for me.
- Is
503withRetry-Afterthe right answer when every session is busy?
I'm happy to open a PR in whatever shape you prefer.
- 主要言語
- TypeScript
- スター
- 16.7k
- フォーク
- 808
- 平均マージ
- 21時間 22分
- マージ済み PR(30日)
- 486
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Effect-TS/effect のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
`@effect/ui-native` (Effect-TS/ui): `kit/VirtualList` `list` part widens `R` to `any`, poisoning enclosing components対応中かも @effect-bot が今日担当しました。 オープン
Effect-TS/effect#11097 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
`@effect/ui-native` (Effect-TS/ui): Controlled `input` rejected-edit restore never calls `host.commit()`対応中かも @effect-bot が今日担当しました。 オープン
Effect-TS/effect#11096 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
Effect-TS/effect の issue をすべて見る
似ている issue
-
check:failed streams:edit
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
iptv-org/iptv#60585 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: Critical path skips a child span that ends exactly when the next one starts対応中かも @Piyush4801 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
jaegertracing/jaeger-ui#4865 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
anthropics/claude-code#112972 ·
-
Type: Improvement
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信