SSE client rejects valid `retry:` field and ignores reconnection timing (Streamable HTTP)
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 45/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Calme
- Stack technique
- java
- Domaine
- api, networking
Piste de recherche
Commencez par l’abonné de lignes SSE dans ResponseSubscribers et ses tests unitaires, en reproduisant le cas minimal de retry : 500. Suivez ensuite la gestion de la reconnexion à travers HttpClientStreamableHttpTransport et DefaultMcpTransportStream, y compris le SPI McpTransportStream. Exécutez le scénario de conformité sse-retry ; c’est terminé lorsque les champs de retry n’échouent plus lors de l’analyse et que la reconnexion respecte le délai fourni par le serveur.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Bug description
The client SSE line parser in ResponseSubscribers rejects the standard SSE retry: field, throwing:
io.modelcontextprotocol.spec.McpTransportException: Invalid SSE response. Status code: 200 Line: retry: 500
Per the SSE specification, retry: sets the stream's reconnection time, and unknown fields MUST be ignored (never error the stream). Because of this, the Streamable HTTP client:
- can error a live SSE stream when the server sends a
retry:line, and - does not honor the server-provided reconnection delay, reconnecting immediately.
This is the MUST-level client-sse-retry-timing failure already noted as a known limitation in conformance-tests/VALIDATION_RESULTS.md.
Environment
- java-sdk
main(2.0.1-SNAPSHOT) - Java 17+
- Transport:
HttpClientStreamableHttpTransport(client), SSE / Streamable HTTP
Steps to reproduce
Run the official MCP conformance sse-retry client scenario:
./mvnw clean package -DskipTests -pl conformance-tests/client-jdk-http-client -am
npx -y @modelcontextprotocol/conformance client \
--command "java -jar conformance-tests/client-jdk-http-client/target/client-jdk-http-client-2.0.1-SNAPSHOT.jar" \
--scenario sse-retry
Observed:
Error: Invalid SSE response. Status code: 200 Line: retry: 500
[client-sse-retry-timing ] FAILURE Client MUST respect the retry field (reconnected ~0ms instead of 500ms)
[client-sse-last-event-id] WARNING Client SHOULD send Last-Event-ID on reconnection
OVERALL: FAILED
Expected behavior
- The SSE parser parses/ignores
retry:(and any unknown SSE field) without erroring the stream. - On reconnection after a drop, the client waits the server-specified
retryinterval before reconnecting.
Minimal reproducible example
Feeding the SSE lines id: e1 / retry: 500 / data: hello / (blank) to the SSE line subscriber currently throws McpTransportException instead of yielding a single event.
Proposed scope (two parts)
- Parser robustness (small, self-contained): parse
retry:and ignore unknown fields inResponseSubscribers. (Implemented locally with unit tests.) - Reconnect timing: honor the parsed
retryvalue before reconnecting inHttpClientStreamableHttpTransport/DefaultMcpTransportStream. This touches theMcpTransportStreamSPI, so I'd like to confirm the preferred approach before opening a PR.
The related Last-Event-ID SHOULD warning appears covered by #830, so I would keep it out of scope here.
Happy to open a PR for part 1 immediately and follow up on part 2 per maintainer guidance.
- Langage dominant
- Java
- Étoiles
- 3.7k
- Forks
- 1.1k
- Merge moyen
- 1 j 15 h
- PR mergées (30 j)
- 9
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de modelcontextprotocol/java-sdk
-
area/transport bug P2
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
modelcontextprotocol/java-sdk#1136 ·
-
area/client bug P2
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
modelcontextprotocol/java-sdk#1124 · 1 commentaire ·
-
ServerCapabilities.logging is added unconditionally, overriding the caller's explicit capabilities Ouvertebug P2 ready for work
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
modelcontextprotocol/java-sdk#1086 · 1 commentaire ·
-
enhancement good first issue P3
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
modelcontextprotocol/java-sdk#1067 ·
-
bug P2 ready for work
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
modelcontextprotocol/java-sdk#898 · 1 commentaire ·
Toutes les issues de modelcontextprotocol/java-sdk
Issues similaires
-
Bug Java Platform: Java
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
getsentry/sentry-java#6138 · 1 commentaire ·
-
bug needs triage p2
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · 1 commentaire ·
-
[Studio][Bug] Bulk-deleting a full page of alert rules steps the page back while more rules remain Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/rocketmq-dashboard#4654 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100