Skip to content

bug(client/streamable_http): prevent infinite SSE reconnect loops with bounded exponential backoff #3356

Closed as not planned

Description

@AAH20

Problem

In StreamableHTTPTransport.handle_get_stream, when an SSE stream disconnects or closes (server-side EOF/backpressure), attempt was reset to 0 upon exit. If an upstream server disconnects continuously, the client bypasses MAX_RECONNECTION_ATTEMPTS and enters an infinite reconnection loop without backoff jitter.

Expected Behavior

The client should respect MAX_RECONNECTION_ATTEMPTS on stream disconnects and apply exponential backoff to prevent thundering-herd storms on upstream MCP servers.

Activity

  1. added
    v2Affects the v2 line (2.x on main)
    v1Affects the v1.x maintenance line
    on Aug 21, 2026
  2. Ben-Home commented on Aug 21, 2026

    @Ben-Home
  3. jagadeepmamidi commented on Sep 1, 2026

    @jagadeepmamidi

    I can reproduce the reconnect-loop behavior described here. I’d be interested in working on a focused fix that keeps the reconnection attempt count bounded across SSE disconnects, applies the existing backoff behavior, and adds regression coverage for repeated disconnects. Happy to work on this if the approach aligns with what you have in mind.

  4. Kludex commented on Oct 14, 2026

    @Kludex
    Member

    Duplicate of #3257.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    v1Affects the v1.x maintenance linev2Affects the v2 line (2.x on main)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions