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

[testbed] Fix loadgenerator race condition #32351

Merged
merged 11 commits into from
May 1, 2024

Conversation

lahsivjar
Copy link
Member

@lahsivjar lahsivjar commented Apr 12, 2024

Description:
Fixes a race condition in testbed's default load generator (ProviderSender). The fix changes the behavior of how logging works for the ProviderSender. Before this PR, the code will try to log errors if the previous error is not the same and it would try to do this across goroutines. Now, each error will be logged if the previous error is not the same for each goroutine.

Alternatively, we can also build a logger using bloom filter to try to log each error once though I am not sure if that would be required. This PR offers a quick fix while keeping the behavior reasonably close to the current behavior.

Closes #32326

Link to tracking Issue: #32326

Testing: Follow the steps in the tracking issue.

Documentation: Not required.

@lahsivjar lahsivjar requested review from a team and atoulme April 12, 2024 13:55
@songy23 songy23 added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Apr 12, 2024
@lahsivjar
Copy link
Member Author

Just realized that I misread the code and the fix will not work 🤦 . Putting it in draft until I figure out the correct fix.

@lahsivjar lahsivjar marked this pull request as draft April 12, 2024 14:11
Copy link
Member

@songy23 songy23 left a comment

Choose a reason for hiding this comment

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

@lahsivjar lahsivjar marked this pull request as ready for review April 12, 2024 14:58
@lahsivjar
Copy link
Member Author

lahsivjar commented Apr 12, 2024

@songy23 Thanks for the review. The previous fix was not totally correct so I have updated the fix to propagate the errors from generate{Traces,Metrics,Logs} to the generate func and handle prevErr based logging there. Also, the lint should be fixed too.

testbed/testbed/load_generator.go Outdated Show resolved Hide resolved
testbed/testbed/load_generator.go Outdated Show resolved Hide resolved
testbed/testbed/load_generator.go Outdated Show resolved Hide resolved
ProviderSender based load generator had a race condition when used with
Parallel option configured to a value greater than 1. The commit fixes
the race condition by changing the behavior of how logging works w.r.t
previously observed errors.
Copy link
Member

@crobert-1 crobert-1 left a comment

Choose a reason for hiding this comment

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

Looks good to me, just one minor suggestion. Thanks for all of your work here, and helping me understand what's going on better! Really appreciate it!

testbed/testbed/load_generator.go Outdated Show resolved Hide resolved
@lahsivjar
Copy link
Member Author

@songy23 @crobert-1 Is there anything blocking here to get this merged?

@songy23 songy23 added the ready to merge Code review completed; ready to merge by maintainers label Apr 18, 2024
@lahsivjar
Copy link
Member Author

@atoulme Friendly ping, will you be able to review this whenever you have time and merge the PR if things look okay?

@lahsivjar
Copy link
Member Author

@atoulme Apologies for the 2nd ping but would it be possible to get this merged this week? (AFAICS the test failures is unrelated to this PR)

@codeboten codeboten merged commit 37f405b into open-telemetry:main May 1, 2024
170 checks passed
@github-actions github-actions bot added this to the next release milestone May 1, 2024
@lahsivjar lahsivjar deleted the fix-load-gen branch May 2, 2024 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Code review completed; ready to merge by maintainers Skip Changelog PRs that do not require a CHANGELOG.md entry testbed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Race condition in testbed load generator when parallel is used
4 participants