Skip to content

Conversation

@richardpark-msft
Copy link
Member

410 (lock lost) handling needed to be separated for sessions and non-session links.

For non-session links losing a link is essentially unrecoverable - the lock cannot be reobtained with just the lock token so further retries will always fail.

For session based links it's different since you actually obtain a session lock by opening a link for a particular session ID. You can retry re-opening the link and there are cases where, on detach, that you might have some overlap until the session is actually available again (this is shown in the TestSessionReceiver_Detach test).

So the split here is simple - all retrying is really handled in amqpLinks, so now it takes a parameter giving it the proper function to determine if an error is fatal or retryable. As part of this I also made the parameters to amqpLinks an arg, which had some small rippling effects in callers.

Fixes #17325
(probable fix for the latest issue mentioned in #17017 since this affects settlement time)

- For non-sessions links retrying will never work - the lock is lost and can't come back.
- For _session_ links it's possible to get the lock after you've lost it since you can basically "recover" the lock by it's name. This comes into play mostly when you lose the lock because of a server-initiated detach.

Most of this is just cleaning up the code so I don't have to add yet another argument to the parameters and can just have a simple struct with names, which helps with readability. I've also made it so the function that amqpLinks uses to determine if it should retry is replaceable.

To keep the refactor size reasonable I didn't take it this _all_ the way through but it's reasonable as it is now.
@richardpark-msft
Copy link
Member Author

/azp run go - azservicebus

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@seankane-msft seankane-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@jhendrixMSFT jhendrixMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple nits.

@richardpark-msft
Copy link
Member Author

/azp run go - azservicebus

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

…in favor of using http.Status* constants instead)
@richardpark-msft
Copy link
Member Author

/azp run go - azservicebus

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[azservicebus] Sessions detach can be inconsistent

3 participants