[Server] Decode an HTTP request body once instead of per pipeline stage
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Refactorización
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- php
- Área
- backend, documentation, performance
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- PHP
- Estrellas
- 1.7k
- Forks
- 206
- Merge medio
- 1 d 17 h
- PR fusionados (30 d)
- 102
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de modelcontextprotocol/php-sdk
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 85/100
modelcontextprotocol/php-sdk#746 ·
Los mantenedores suelen responder en 1 día
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStanAbiertoServer
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
modelcontextprotocol/php-sdk#468 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
[Server] Handle notifications/cancelled on the handshake eraPosiblemente ocupada @ump45nose la tomó hace 5 días. Abiertohelp wanted improves spec compliance Server
Dificultad 4/5 3-5 días Aptitud para principiantes 57/100
modelcontextprotocol/php-sdk#732 ·
Los mantenedores suelen responder en 1 día
-
[Client][Server] Ship extension classes for the two authorization extensionsPosiblemente ocupada @chr-hertel la tomó hace 6 días. Abiertoauth Client Server
modelcontextprotocol/php-sdk#721 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[Client] Test cross-app access against a real identity providerPosiblemente ocupada @chr-hertel la tomó hace 6 días. Abiertoauth Client
modelcontextprotocol/php-sdk#720 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de modelcontextprotocol/php-sdk
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
pluginsGLPI/carbon#396 ·
-
[BUG] Bundle products lose their price in RSS feeds: getPrices() was removedPosiblemente ocupada @pcvelz la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
OpenMage/magento-lts#5869 ·
Los mantenedores suelen responder en 2 días
-
Map Info Window ButtonsAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
OpenGIS/waymark-wp#82 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
claude
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
sprain/sprainocchio#39 ·
Los mantenedores suelen responder en 1 día