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

xds resolver: fix edge cases in interactions between LDS and RDS #31668

Merged
merged 5 commits into from Nov 16, 2022

Conversation

markdroth
Copy link
Member

This fixes a couple of bugs accidentally introduced in #31457. It adds tests for those bugs and for the edge cases discussed in #25528.

Once this gets merged, it will need to be back-ported to the 1.51 branch before the release. CC @gnossen

::testing::Values(XdsTestType().set_enable_rds_testing()),
&XdsTestType::Name);

TEST_P(LdsRdsInteractionTest, SwitchFromRdsToInlineRouteConfig) {
Copy link
Member

Choose a reason for hiding this comment

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

which of these tests were failing before this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Without the fix, both SwitchFromRdsToInlineRouteConfig and HcmConfigUpdatedWithoutRdsChange fail.

Copy link
Member

@yashykt yashykt left a comment

Choose a reason for hiding this comment

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

The sleep bothers me but otherwise looks ok

while (true) {
ASSERT_LT(absl::Now(), deadline) << "timed out waiting for LDS ACK";
response_state = balancer_->ads_service()->lds_response_state();
if (response_state.has_value()) break;
absl::SleepFor(absl::Seconds(1) * grpc_test_slowdown_factor());
Copy link
Member

Choose a reason for hiding this comment

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

uh oh! Why do we need a sleep?

Copy link
Member Author

Choose a reason for hiding this comment

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

The sleep just avoids wasting CPU time. Without it, this is just a busy loop, constantly checking the same thing over and over again. With the sleep, we pause to actually give the system time to change state before we check again.

Note that the sleep does not affect the overall 30-second deadline for getting the ACK.

Copy link
Member

Choose a reason for hiding this comment

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

something like using a notification might be better

ASSERT_LT(absl::Now(), deadline) << "timed out waiting for LDS ACK";
response_state = balancer_->ads_service()->lds_response_state();
if (response_state.has_value()) break;
absl::SleepFor(absl::Seconds(1) * grpc_test_slowdown_factor());
Copy link
Member

Choose a reason for hiding this comment

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

here too, why do we need the sleep?

Copy link
Member

Choose a reason for hiding this comment

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

If we need it anyway, can you add a comment as to why?

Copy link
Member Author

Choose a reason for hiding this comment

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

Same answer as above. It doesn't change the behavior, just avoids wasting CPU time.

ASSERT_LT(absl::Now(), deadline) << "timed out waiting for RDS ACK";
response_state = balancer_->ads_service()->rds_response_state();
if (response_state.has_value()) break;
absl::SleepFor(absl::Seconds(1) * grpc_test_slowdown_factor());
Copy link
Member

Choose a reason for hiding this comment

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

here too, why do we need the sleep?

Copy link
Member Author

Choose a reason for hiding this comment

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

Same answer as above. It doesn't change the behavior, just avoids wasting CPU time.

@markdroth markdroth merged commit 64589d7 into grpc:master Nov 16, 2022
@markdroth markdroth deleted the xds_lds_update_fix branch November 16, 2022 19:04
markdroth added a commit to markdroth/grpc that referenced this pull request Nov 16, 2022
…c#31668)

* xds resolver: fix edge cases in interactions between LDS and RDS

* improve SwitchFromInlineRouteConfigToRds test

* clang-tidy

* Automated change: Fix sanity tests

Co-authored-by: markdroth <markdroth@users.noreply.github.com>
markdroth added a commit that referenced this pull request Nov 16, 2022
) (#31672)

* xds resolver: fix edge cases in interactions between LDS and RDS

* improve SwitchFromInlineRouteConfigToRds test

* clang-tidy

* Automated change: Fix sanity tests

Co-authored-by: markdroth <markdroth@users.noreply.github.com>

Co-authored-by: markdroth <markdroth@users.noreply.github.com>
@copybara-service copybara-service bot added the imported Specifies if the PR has been imported to the internal repository label Nov 16, 2022
jtattermusch added a commit that referenced this pull request Jan 11, 2023
* Bump  v1.51.x to 1.51.0-pre1 (#31622)

* bump version to 1.51.0-pre1

* regenerate projects

* Branch 1.51.x: Cherrypick "Adding token url validation cases for psc endpoints #31616" and "Added url validation for aws metadata endpoints in aws external account #31626" (#31646)

* Adding token url validation cases for psc endpoints (#31616)

* Adding validation case for psc endpoint

* formatting fix

* Added url validation for aws metadata endpoints in aws external account (#31626)

* Added url validation for aws metadata endpoints in aws external account

* addressing review comments

* fix error message back

* Fix broken test

* xds resolver: fix edge cases in interactions between LDS and RDS (#31668) (#31672)

* xds resolver: fix edge cases in interactions between LDS and RDS

* improve SwitchFromInlineRouteConfigToRds test

* clang-tidy

* Automated change: Fix sanity tests

Co-authored-by: markdroth <markdroth@users.noreply.github.com>

Co-authored-by: markdroth <markdroth@users.noreply.github.com>

* xDS: fix crash on wrong listener type (both client and server side) (#31684) (#31691)

* xds resolver: fix crash on wrong listener type

* fix same bug on server side

* fix clang-tidy and add requested TODO

* Bump v1.51.x to v1.51.0 (#31705)

* bump version to 1.51.0

* regenerate projects

* Revert "Build with System OpenSSL on Mac OS arm64 (#31096)" (#31739)

This reverts commit b3d9833.

* Bump v1.51.x to 1.51.1 (#31740)

* Bump to 1.51.1

* Regenerate projects

Co-authored-by: Richard Belleville <rbellevi@google.com>
Co-authored-by: aeitzman <12433791+aeitzman@users.noreply.github.com>
Co-authored-by: Mark D. Roth <roth@google.com>
Co-authored-by: markdroth <markdroth@users.noreply.github.com>
wanlin31 pushed a commit that referenced this pull request May 18, 2023
* Bump  v1.51.x to 1.51.0-pre1 (#31622)

* bump version to 1.51.0-pre1

* regenerate projects

* Branch 1.51.x: Cherrypick "Adding token url validation cases for psc endpoints #31616" and "Added url validation for aws metadata endpoints in aws external account #31626" (#31646)

* Adding token url validation cases for psc endpoints (#31616)

* Adding validation case for psc endpoint

* formatting fix

* Added url validation for aws metadata endpoints in aws external account (#31626)

* Added url validation for aws metadata endpoints in aws external account

* addressing review comments

* fix error message back

* Fix broken test

* xds resolver: fix edge cases in interactions between LDS and RDS (#31668) (#31672)

* xds resolver: fix edge cases in interactions between LDS and RDS

* improve SwitchFromInlineRouteConfigToRds test

* clang-tidy

* Automated change: Fix sanity tests

Co-authored-by: markdroth <markdroth@users.noreply.github.com>

Co-authored-by: markdroth <markdroth@users.noreply.github.com>

* xDS: fix crash on wrong listener type (both client and server side) (#31684) (#31691)

* xds resolver: fix crash on wrong listener type

* fix same bug on server side

* fix clang-tidy and add requested TODO

* Bump v1.51.x to v1.51.0 (#31705)

* bump version to 1.51.0

* regenerate projects

* Revert "Build with System OpenSSL on Mac OS arm64 (#31096)" (#31739)

This reverts commit b3d9833.

* Bump v1.51.x to 1.51.1 (#31740)

* Bump to 1.51.1

* Regenerate projects

Co-authored-by: Richard Belleville <rbellevi@google.com>
Co-authored-by: aeitzman <12433791+aeitzman@users.noreply.github.com>
Co-authored-by: Mark D. Roth <roth@google.com>
Co-authored-by: markdroth <markdroth@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bloat/none imported Specifies if the PR has been imported to the internal repository lang/c++ lang/core per-call-memory/neutral per-channel-memory/neutral priority/P0/RELEASE BLOCKER release notes: no Indicates if PR should not be in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants