[Server] Decode an HTTP request body once instead of per pipeline stage
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
- Issue-Typ
- Refactoring
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- php
- Bereich
- backend, documentation, performance
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- PHP
- Sterne
- 1.7k
- Forks
- 206
- Ø Merge
- 1 T. 17 Std.
- Gemergte PRs (30 T.)
- 102
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus modelcontextprotocol/php-sdk
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 85/100
modelcontextprotocol/php-sdk#746 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStanOffenServer
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 78/100
modelcontextprotocol/php-sdk#468 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Server] Handle notifications/cancelled on the handshake eraEvtl. vergeben @ump45nose hat das vor 5 Tagen übernommen. Offenhelp wanted improves spec compliance Server
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 57/100
modelcontextprotocol/php-sdk#732 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Client][Server] Ship extension classes for the two authorization extensionsEvtl. vergeben @chr-hertel hat das vor 6 Tagen übernommen. Offenauth Client Server
modelcontextprotocol/php-sdk#721 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Client] Test cross-app access against a real identity providerEvtl. vergeben @chr-hertel hat das vor 6 Tagen übernommen. Offenauth Client
modelcontextprotocol/php-sdk#720 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in modelcontextprotocol/php-sdk
Ähnliche Issues
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
pluginsGLPI/carbon#396 ·
-
[BUG] Bundle products lose their price in RSS feeds: getPrices() was removedEvtl. vergeben @pcvelz hat das heute übernommen. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
OpenMage/magento-lts#5869 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Map Info Window ButtonsOffen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
OpenGIS/waymark-wp#82 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
claude
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
sprain/sprainocchio#39 ·
Maintainer antworten meist innerhalb von 1 Tag