xds: suppress the duplicate errors at the client side#9185
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9185 +/- ##
==========================================
- Coverage 83.20% 83.08% -0.12%
==========================================
Files 418 419 +1
Lines 33741 33867 +126
==========================================
+ Hits 28073 28140 +67
- Misses 4250 4290 +40
- Partials 1418 1437 +19
🚀 New features to boost your workflow:
|
| isDuplicateErr := state.md.ErrState != nil && state.md.ErrState.Err != nil && state.md.ErrState.Err.Error() == uErr.Err.Error() | ||
| var errState *xdsresource.UpdateErrorMetadata | ||
| if md.ErrState != nil { | ||
| errState = &xdsresource.UpdateErrorMetadata{ |
There was a problem hiding this comment.
Why do we need to do this ? Can't we directly do state.md.ErrState = md.ErrState like earlier ?
| }) | ||
| } | ||
| state.md.ErrState = md.ErrState | ||
| isDuplicateErr := state.md.ErrState != nil && state.md.ErrState.Err != nil && state.md.ErrState.Err.Error() == uErr.Err.Error() |
There was a problem hiding this comment.
Also instead of evaluating this as a variable and then checking can we instead do the assignment first(which I assume needs to be done for either case) and then directly in an if block we can evaluate the condition and call continue on true. WDYT ?
There was a problem hiding this comment.
Can we have the test in https://github.com/grpc/grpc-go/blob/master/internal/xds/clients/xdsclient/test/lds_watchers_test.go or any other test file in the internal/xds/clients/xdsclient package instead of having it in a different xdsclient/tests package?
Or if there is a reason that we have added the test here , please let me know.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces duplicate error suppression for ADS resource updates in the xDS client, skipping watcher notifications when duplicate errors are received, and adds a corresponding test to verify this behavior. The reviewer identified a critical issue in authority.go where a nil pointer dereference panic could occur if md.ErrState is nil but uErr.Err is non-nil, and provided a code suggestion to safely initialize errState.
Fixes #8994
This change suppresses duplicate errors on the xds client side by skipping calling watchers for the duplicates. This also prevents generating new child names for the same broken EDS resource (EDS resource has no localities) that is being re-send by the control plane.
RELEASE NOTES: