[Server] Decode an HTTP request body once instead of per pipeline stage
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- php
調査の方向性
Start with InboundClassifier::classify(), Protocol and StatelessProtocol, MessageFactory::create(), and Json::objectsToArrays() to trace how the request body is decoded across the StreamableHttpTransport pipeline. Check the HTTP transport tests and add coverage showing that one decoded message is shared through classification and handling. Update docs/run/http.md to explain that maxBodyBytes limits encoded bytes and that decoded memory use depends on body shape; the issue leaves whether to lower the default unresolved.
索引モデルが issue の本文から書いたものです。
説明
Currently a POST body is decoded several times before it reaches a handler: InboundClassifier::classify(), then Protocol or StatelessProtocol, then MessageFactory::create() and Json::objectsToArrays(). Not all copies are alive at the same time, but peak memory ends up at about twice a single decode, and the CPU cost is paid on every pass - also for requests that are rejected right after.
Measured on main with a tools/call for an unknown tool through StreamableHttpTransport:
| body (600 KB) | one json_decode() |
full pipeline |
|---|---|---|
list of [0] |
35.6 MB | 74.4 MB |
list of {"a":0} |
31.9 MB | 68.4 MB |
list of {} |
4.0 MB | 33.4 MB |
| list of ints | 8.0 MB | 19.1 MB |
Two things to do:
- decode once at the edge and pass the decoded message down, so classification, the protocol and the
MessageFactoryshare it - document in
docs/run/http.mdthatmaxBodyBytesbounds bytes, not decoded size - adversarial shapes need ~60x the body in memory, so the cap should be sized againstmemory_limit. Maybe also worth lowering the 4 MiB default.
Reported by @kanokwut.
- 主要言語
- PHP
- スター
- 1.7k
- フォーク
- 206
- 平均マージ
- 1日 17時間
- マージ済み PR(30日)
- 102
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/php-sdk のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
modelcontextprotocol/php-sdk#746 ·
メンテナーはふだん 1 日以内に返信
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStanオープンServer
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
modelcontextprotocol/php-sdk#468 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
[Server] Handle notifications/cancelled on the handshake era対応中かも @ump45nose が 5 日前に担当しました。 オープンhelp wanted improves spec compliance Server
難易度 4/5 3〜5日 初心者へのやさしさ 57/100
modelcontextprotocol/php-sdk#732 ·
メンテナーはふだん 1 日以内に返信
-
[Client][Server] Ship extension classes for the two authorization extensions対応中かも @chr-hertel が 6 日前に担当しました。 オープンauth Client Server
modelcontextprotocol/php-sdk#721 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[Client] Test cross-app access against a real identity provider対応中かも @chr-hertel が 6 日前に担当しました。 オープンauth Client
modelcontextprotocol/php-sdk#720 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
modelcontextprotocol/php-sdk の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
pluginsGLPI/carbon#396 ·
-
[BUG] Bundle products lose their price in RSS feeds: getPrices() was removed対応中かも @pcvelz が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
OpenMage/magento-lts#5869 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
OpenGIS/waymark-wp#82 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
claude
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
sprain/sprainocchio#39 ·
メンテナーはふだん 1 日以内に返信