Skip to content

ClientSession.Subscribe can silently succeed while the session is closing #1171

Description

@jstar0

Under the SEP-2575 path, ClientSession.Subscribe starts a subscriptions/listen request without awaiting the stream response. If the session has already started closing, or if Close races with Subscribe startup, Subscribe can return nil even though the listen stream was cancelled or rejected. In that case the local resourceSubs map can also keep an entry for a subscription that was never successfully started.

Reproduction:

  1. Connect a ClientSession with protocolVersion20260728.
  2. Close the session, or have Close start while Subscribe is entering the subscriptions/listen send path.
  3. Call Subscribe for a resource URI.

Expected:
Subscribe reports ErrConnectionClosed and does not leave a local resource subscription registered.

Actual:
Subscribe can report success or context cancellation without consistently rolling back the resource subscription entry.

Environment:
go version go1.26.5 darwin/arm64

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions