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

FaultInjection: Fix random number generation #30623

Merged
merged 8 commits into from Aug 18, 2022

Conversation

yashykt
Copy link
Member

@yashykt yashykt commented Aug 17, 2022

rand() is not thread-safe, so instead use absl::InsecureBitGen and absl::Uniform to generate random numbers.

Copy link
Member

@markdroth markdroth left a comment

Choose a reason for hiding this comment

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

This looks really good! Just one comment to address.

@@ -204,7 +204,13 @@ TEST_P(FaultInjectionTest, XdsFaultInjectionPercentageAbortViaHeaders) {

TEST_P(FaultInjectionTest, XdsFaultInjectionPercentageDelay) {
CreateAndStartBackends(1);
const uint32_t kFixedDelayMilliseconds = 100000;
#ifndef NDEBUG
Copy link
Member

Choose a reason for hiding this comment

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

I'm really not keen on putting #ifndefs in the middle of individual tests. Can we not just increase the timeout even for opt builds?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@yashykt
Copy link
Member Author

yashykt commented Aug 18, 2022

Thanks for reviewing!

@yashykt yashykt merged commit 02df22f into grpc:master Aug 18, 2022
@copybara-service copybara-service bot added the imported Specifies if the PR has been imported to the internal repository label Aug 19, 2022
@yashykt yashykt deleted the FaultInjectionRand branch May 18, 2023 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bloat/low imported Specifies if the PR has been imported to the internal repository lang/core per-call-memory/neutral per-channel-memory/neutral release notes: yes Indicates if PR needs to be in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants