fix: use proto.Equal to compare protobuf messages#125
Merged
Conversation
replace reflect deepequal with proto.Equal reflection is comparing some internal fields used during marshaling, causing race conditions in the beats reloader code. the race condition causes APM Server tests to fail with the race detector enabled
2 tasks
💚 Build Succeeded
|
cmacknz
approved these changes
Nov 26, 2024
Member
|
I don't think this code is used anymore, but it was wrong before regardless. |
Member
|
Nevermind, this is in unit.go not the v1 client. |
Member
A test to catch this would look like marshalling and then unmarshalling one of the messages under test before using it in the test to populate all the internal fields to get the comparison to fail. Hard to know to do this until you have been burned by this at least once. |
Member
Author
|
fwiw APM Server beats tests fail consistently without this fix: https://github.com/elastic/apm-server/actions/runs/12037657802/job/33561591630?pr=13827 |
This file contains hidden or 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
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.
replace reflect deepequal with proto.Equal
reflection is comparing some internal fields used during marshaling, causing race conditions in the beats reloader code.
the race condition causes APM Server tests to fail with the race detector enabled