xds: Fix flaky test Test/ServerSideXDS_WithValidAndInvalidSecurityConfiguration #7411
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.
In the logs of failing runs for
TestServerSideXDS_WithValidAndInvalidSecurityConfiguration, we see that the resource snapshot update request is sent to the xds management server before the xds client is able to connect to it. Every time a gRPC server receives the updated snapshot resource from the xds server, it sends a NACK as the configuration is invalid. When the server receives more than one NACK, it gets stuck while writing to a buffered channel here:grpc-go/test/xds/xds_server_certificate_providers_test.go
Line 249 in d27ddb5
This results in the gRPC server timing out while getting the new configuration.
This change ensures that the server writes to the buffered channel at most once and doesn't get stuck.
Example failure: https://github.com/grpc/grpc-go/actions/runs/9790522733/job/27032314481?pr=7390
Tested
Verified that the test no longer fails in 100000 runs
Updates: #6914
RELEASE NOTES: None