Repository navigation
v4: absorb main 3.5.0, part 5 - pub/sub: retry a failed subscribe from the heartbeat - #3409
Merged
Merged
Conversation
…tion stays up (port of main #3387) A subscribe that fails (declined with BUSY, timed out, or never written) keeps its handler registered, so the subscription is restored when the subscription connection is replaced. Until then nothing retried it, so with the connection up the caller stayed deaf indefinitely (#3371). v4 had the same gap. - A subscribe is never sent as fire-and-forget on the wire. A caller who asked for that, including the restore after a reconnect, still does not wait, but a declined subscribe is now observed rather than completing when written. - A failure that can pass (a timeout, a connection failure, or a refusal reflecting the server's own state: FaultContext.NotApplied) records a retry owed (IsTransientSubscribeFault, as main). - The heartbeat consumes that and re-drives each wanted subscription that has no server, on a server whose subscription connection is up; one that is down asks for another look next time. An exception in the sweep is reported once until it runs clean. - docs/Basics.md: what happens when subscribing fails, and what SubscribedEndpoint returns. A fire-and-forget subscribe now records its server on the acknowledgement rather than on send, so the overlapping-restore test's fire-and-forget case goes back to main's expectation (the deferred restore counts as a pending change). Main's FailedSubscribeUnitTests (44 cases) apply as-is; with the retry stubbed out, 14 fail.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fifth slice of absorbing main's 3.5.0 into v4 (after #3403, #3406, #3407, #3408): main's #3387. This completes the pub/sub batch.
The bug (#3371)
A subscribe that fails (declined with
BUSY, timed out, or never written) keeps its handler registered, so the subscription is restored when the subscription connection is replaced. Until then nothing retried it, so with the connection up the caller stayed deaf indefinitely. v4 had the same gap.How it maps onto v4
Every v4 subscribe goes through
Subscription.SendAsync, so this is smaller than main's change.EnsureSubscriptionssends fire-and-forget. It is now sent as a normal command and observed, as v4: absorb main 3.5.0, part 4 - pub/sub: retire subscriptions the server still holds #3408 already does for unsubscribes. A caller who asked for fire-and-forget still doesn't wait.BUSY,LOADING,TRYAGAIN:FaultContext.NotApplied) records a retry owed. This is main'sIsTransientSubscribeFault.NOPERMand the like would fail the same way forever, so they aren't retried.docs/Basics.md: what happens when subscribing fails, why not to retry with the same handler, and whatSubscribedEndpointreturns. Taken from main.A fire-and-forget subscribe now records its server when it is acknowledged rather than when it is sent. So the fire-and-forget case of
OverlappingRestoresCannotSubscribeOnTwoServers, which #3407 had to relax, goes back to main's expectation: the deferred restore counts as a pending change.Tests
FailedSubscribeUnitTests(main's, 44 cases) apply as-is. With the observed send and the heartbeat retry stubbed out, 14 of them fail (every retry case, on both protocols).