Skip to content

Pub/sub: client and server subscription state can disagree #3375

Open

Description

@mgravell

Several recent reports share one root: the client's record of a subscription changes without the server's acknowledgement. This issue tracks what remains after the individual fixes.

Fixed or in review:

Outstanding:

  1. Unsubscribe while a subscribe is unacknowledged. No unsubscribe is sent, because no server is recorded yet; when the ack lands the server stays subscribed. Found by @vkyow in Fix duplicate Pub/Sub subscription restoration after Sentinel failover #3337. Acceptance tests: the four in-flight scenarios from that PR (UnsubscribeWaitsForAnInFlightSubscribe, TimedOutSynchronousUnsubscribeStillDetachesThePendingSubscription, UnsubscribeAllContinuesPastAnInFlightSubscription, LateCleanupDoesNotUnsubscribeTheReplacementOwner), which fail on main and on Pub/sub: overlapping subscription restores cannot register on two servers #3353.
  2. An unsubscribe the server declined (BUSY, LOADING, ...) leaves it subscribed - Pub/Sub: a failed unsubscribe of the last handler leaves the server subscribed while the client forgets it #3367. Acceptance tests: FailedUnsubscribeUnitTests from Pub/Sub: retry a last unsubscribe the server declined, rather than leaving it subscribed #3368.
  3. A failed cleanup of a stray subscription leaves duplicate delivery until reconnect. No test yet. A delivery filter by owning connection (as in Fix duplicate Pub/Sub subscription restoration after Sentinel failover #3337) is one option, at the cost of failing closed.
  4. Brief duplicate delivery when a user subscribe overlaps an internal restore. Probably acceptable; to be documented.

Proposed direction for 1 and 2: an explicit "retiring" state on the subscription, honoured by the ack and restore paths and driven by the existing heartbeat, so the client keeps a record until the server confirms.

Separate, not part of this: #3357 (publish pinned to the subscribed endpoint).

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