Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@corhere
Copy link
Contributor

@corhere corhere commented May 14, 2025

- What I did
- How I did it
(*NetworkDB).SetPrimaryKey() acquires a read lock on the NetworkDB instance. That seems sound on the surface as it is only reading from the NetworkDB struct, not mutating it. However, concurrent calls to (*memberlist.Keyring).UseKey() would get flagged by Go's race detector due to some questionable locking in its implementation. Acquire an exclusive lock in SetPrimaryKey so concurrent calls don't race each other.

- How to verify it
By inspection.

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

(*NetworkDB).SetPrimaryKey() acquires a read lock on the NetworkDB
instance. That seems sound on the surface as it is only reading from the
NetworkDB struct, not mutating it. However, concurrent calls to
(*memberlist.Keyring).UseKey() would get flagged by Go's race detector
due to some questionable locking in its implementation. Acquire an
exclusive lock in SetPrimaryKey so concurrent calls don't race each
other.

Signed-off-by: Cory Snider <[email protected]>
@corhere corhere requested review from robmry and thaJeztah May 14, 2025 23:58
@corhere corhere added kind/bugfix PR's that fix bugs area/networking/d/overlay Networking labels May 14, 2025
@corhere
Copy link
Contributor Author

corhere commented May 14, 2025

Since this is just a theoretical problem, I don't think it's worthwhile to changelog or cherry-pick this change.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@robmry robmry added this to the 28.2.0 milestone May 15, 2025
@robmry robmry merged commit b87aecc into moby:master May 15, 2025
147 checks passed
@corhere corhere deleted the libn/set-primary-key-lock branch May 15, 2025 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants