-
Notifications
You must be signed in to change notification settings - Fork 2k
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 data race in node upsert #24127
fix data race in node upsert #24127
Conversation
nomad/structs/structs.go
Outdated
// COMPAT remove in 1.9+ | ||
// apply compatibility fixups covering node topology |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shoenig: is this instead safe to simply remove in 1.9 as suggested by this comment? It looks like we introduced this in 1.6.x. We'll need to be safe for folks to upgrade from 1.6.x to 1.9 but not earlier than that.
We introduced this in 1.7. We should hold off removing until 1.10 LTS. I've updated the associated comments in this PR.
While testing with agents built with the race-detection option enabled, I encountered a data race while draining a node. When we upsert a node we copy the `NodeResources` struct and then perform a fixup for backwards compatibility of the topology struct. This fixup was being executed on the original struct and not the copy, which means we're uselessly fixing up the wrong struct and we're corrupting the state store in the process (albeit harmlessly, I suspect). Fix the data race by calling the method on the correct pointer.
1a2d2c8
to
4ccc1b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌚 (;new_moon_with_face:)
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
While testing with agents built with the race-detection option enabled, I encountered a data race while draining a node.
When we upsert a node we copy the
NodeResources
struct and then perform a fixup for backwards compatibility of the topology struct. This fixup was being executed on the original struct and not the copy, which means we're uselessly fixing up the wrong struct and we're corrupting the state store in the process (albeit harmlessly, I suspect).Fix the data race by calling the method on the correct pointer.