-
Notifications
You must be signed in to change notification settings - Fork 53
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
Core: Refactored the connection container lock to use a sync RwLock #2643
Merged
Conversation
This file contains 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
barshaul
force-pushed
the
change_lock_to_sync
branch
2 times, most recently
from
November 7, 2024 13:31
68d8aab
to
b241c51
Compare
eifrah-aws
requested changes
Nov 7, 2024
barshaul
force-pushed
the
change_lock_to_sync
branch
from
November 11, 2024 09:55
3b73873
to
71708f5
Compare
eifrah-aws
approved these changes
Nov 11, 2024
…ections Signed-off-by: barshaul <barshaul@amazon.com>
Signed-off-by: barshaul <barshaul@amazon.com>
…wLock instead of an asynchronous one, and reducing lock acquisition time. Signed-off-by: barshaul <barshaul@amazon.com>
Signed-off-by: barshaul <barshaul@amazon.com>
barshaul
force-pushed
the
change_lock_to_sync
branch
from
November 11, 2024 13:55
71708f5
to
2b72b8f
Compare
avifenesh
added a commit
to avifenesh/valkey-glide
that referenced
this pull request
Nov 11, 2024
…alkey-io#2643) * Core: Refactored the connection container lock to use a synchronous RwLock instead of an asynchronous one, and reducing lock acquisition time. * Core: Fixed redis-rs pubsub tests for server version >= 7.2.4 Signed-off-by: barshaul <barshaul@amazon.com>
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.
Core: Refactored the Connection Container Lock to Use a Synchronous RwLock
This PR refactors the connection container lock to use a synchronous RwLock instead of an asynchronous one, ensuring that the lock is held only briefly and not across await points. This change addresses potential deadlocks and improves overall lock acquisition time.
Background
In the redis-rs implementation, the entire request pipeline is blocked while the cluster client is in a recovery state. Specifically, when poll_flush calls poll_recover, the system waits for the recovery future to complete before processing other tasks. During this recovery period, some in-flight requests may already be running but remain pending. This creates a risk of deadlock if a request holds the connection container lock while the recovery future is waiting for it.
Why the Change was Made
Switching to a synchronous lock ensures that the recovery state cannot be entered while the connection container lock is held, thus preventing the recovery future from getting stuck. By preventing requests from holding the lock across await points, we reduce the risk of deadlocks.