-
Notifications
You must be signed in to change notification settings - Fork 696
Fix SSE transport not properly handling HTTP/2 NO_ERROR disconnections #509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix SSE transport not properly handling HTTP/2 NO_ERROR disconnections #509
Conversation
…P2 idle timeout disconnections gracefully. This allows applications to distinguish between actual errors and expected connection drops.
WalkthroughThe changes introduce connection lost detection and handling for the SSE (Server-Sent Events) transport in the MCP-Go SDK. A handler for connection loss events can now be registered, specifically to address HTTP/2 idle timeout disconnections. The documentation and tests are updated to reflect and validate this new behavior. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Suggested reviewers
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Description
The current SSE transport implementation does not properly handle HTTP/2 connection terminations that occur due to idle timeouts as specified in RFC 9113. When a connection is closed with the HTTP/2 error code
NO_ERROR
, the client cannot detect that the connection has been lost, as it treats this as a regular error and silently fails without notifying the application. This causes the transport to become non-functional after long periods of inactivity, with no way for the application to detect and recover from these legitimate connection closures.If a connection containing the error message
NO_ERROR
is closed, change it to call the connection disconnect handler so that you can detect the connection disconnect. Developers using Client can then decide what to do and implement the necessary measures.Type of Change
Checklist
MCP Spec Compliance
Additional Information
Summary by CodeRabbit
Summary by CodeRabbit