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

Fix race condition in clusterNodes.Addrs() #3219

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shawnwgit
Copy link

Resolve a Race Condition in clusterNodes.Addrs() Method.
The clusterNodes.Addrs() method previously returned a reference to a string slice, which introduced the potential for concurrent read operations by callers while the slice was being modified, potentially leading to undefined behavior. This race condition could occur during GC or other operations affecting the slice.

Fix: Updated the clusterNodes.Addrs() method to create and return a copy of the original addrs slice. By ensuring that callers receive an independent copy, we eliminate the possibility of concurrent access issues.

Fixes #3218

Resolve a race condition in the clusterNodes.Addrs() method.
Previously, the method returned a reference to a string slice, creating
the potential for concurrent reads by the caller while the slice was
being modified by the garbage collection process.
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.

Race condition in function clusterNodes.Addrs()
1 participant