Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Semaphore Lease Contention Handling #10666

Merged
merged 3 commits into from
Mar 3, 2022
Merged

Conversation

rosstimothy
Copy link
Contributor

Add the same retry logic from AcquireSemaphore to CancelSemaphoreLease
to handle contetion. Without the retry it is possible for a cancellation
to fail and the lease in question to remain held for its entire expiry.
If the number of cancellations that fail is >= max_connections then
this causes a user to effectively be locked out until the leases are
expired.

Fixes #10363

@rosstimothy rosstimothy marked this pull request as ready for review February 28, 2022 16:57
Copy link
Contributor

@jimbishopp jimbishopp left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +805 to +806
const baseBackoff = time.Millisecond * 300
const leaseRetryAttempts int64 = 6
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if it is worth doing now, but it would be nice if these were variables in PresenceService so we could add test coverage for the LimitExceeded error without having to wait 4.5 seconds.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I agree. I was trying to limit the noise in this PR though.

Add the same retry logic from `AcquireSemaphore` to `CancelSemaphoreLease`
to handle contetion. Without the retry it is possible for a cancellation
to fail and the lease in question to remain held for its entire expiry.
If the number of cancellations that fail is >= `max_connections` then
this causes a user to effectively be locked out until the leases are
expired.

Fixes #10363
@rosstimothy rosstimothy merged commit 18a7696 into master Mar 3, 2022
@rosstimothy rosstimothy deleted the tross/semaphore_cancel branch March 3, 2022 17:04
rosstimothy added a commit that referenced this pull request Mar 4, 2022
Add the same retry logic from `AcquireSemaphore` to `CancelSemaphoreLease`
to handle contetion. Without the retry it is possible for a cancellation
to fail and the lease in question to remain held for its entire expiry.
If the number of cancellations that fail is >= `max_connections` then
this causes a user to effectively be locked out until the leases are
expired.

Fixes #10363
rosstimothy added a commit that referenced this pull request Mar 4, 2022
Add the same retry logic from `AcquireSemaphore` to `CancelSemaphoreLease`
to handle contetion. Without the retry it is possible for a cancellation
to fail and the lease in question to remain held for its entire expiry.
If the number of cancellations that fail is >= `max_connections` then
this causes a user to effectively be locked out until the leases are
expired.

Fixes #10363
rosstimothy added a commit that referenced this pull request Mar 4, 2022
Add the same retry logic from `AcquireSemaphore` to `CancelSemaphoreLease`
to handle contetion. Without the retry it is possible for a cancellation
to fail and the lease in question to remain held for its entire expiry.
If the number of cancellations that fail is >= `max_connections` then
this causes a user to effectively be locked out until the leases are
expired.

Fixes #10363
rosstimothy added a commit that referenced this pull request Mar 10, 2022
Add the same retry logic from `AcquireSemaphore` to `CancelSemaphoreLease`
to handle contetion. Without the retry it is possible for a cancellation
to fail and the lease in question to remain held for its entire expiry.
If the number of cancellations that fail is >= `max_connections` then
this causes a user to effectively be locked out until the leases are
expired.

Fixes #10363
rosstimothy added a commit that referenced this pull request Mar 10, 2022
Add the same retry logic from `AcquireSemaphore` to `CancelSemaphoreLease`
to handle contetion. Without the retry it is possible for a cancellation
to fail and the lease in question to remain held for its entire expiry.
If the number of cancellations that fail is >= `max_connections` then
this causes a user to effectively be locked out until the leases are
expired.

Fixes #10363
rosstimothy added a commit that referenced this pull request Mar 11, 2022
* Better Semaphore Lease Contention Handling (#10666)

Add the same retry logic from `AcquireSemaphore` to `CancelSemaphoreLease`
to handle contetion. Without the retry it is possible for a cancellation
to fail and the lease in question to remain held for its entire expiry.
If the number of cancellations that fail is >= `max_connections` then
this causes a user to effectively be locked out until the leases are
expired.

Fixes #10363
@webvictim webvictim mentioned this pull request Apr 19, 2022
@webvictim webvictim mentioned this pull request Jun 8, 2022
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.

Slow session reclaim prevents using full max_connections allowance
3 participants