Skip to content

Conversation

@easwars
Copy link
Contributor

@easwars easwars commented Mar 1, 2022

Summary of changes:

  • Suppress redundant mode changes in the listenerWrapper
  • Throw a log entry from the xDS server if and only if a mode change callback is not registered
  • Throw a single log entry from the mode change callback registered by the xDS interop server

Test changes:

  • Register a mode change callback from integration tests to get around our testLogger failing the test
  • Replace some calls to t.Errorf() with t.Fatalf()

Fixes #4939

RELEASE NOTES: none

@easwars easwars added this to the 1.46 Release milestone Mar 1, 2022
@easwars easwars requested a review from dfawley March 1, 2022 19:42
@easwars
Copy link
Contributor Author

easwars commented Mar 10, 2022

@dfawley : I made the change we discussed offline to register a callback to log the mode changes if the user did not register any. And therefore, we can directly invoke the callback without a nil check. PTAL.

@easwars easwars force-pushed the xds_serving_mode_log_spam branch from 9e591f0 to f563be3 Compare March 16, 2022 00:33
@easwars
Copy link
Contributor Author

easwars commented Mar 16, 2022

@dfawley : Ping ...

xds/server.go Outdated
// Note that this means that `s.opts.modeCallback` will never be nil and can
// safely be invoked directly from `handleServiceModeChanges`.
if so.modeCallback == nil {
so.modeCallback = func(addr net.Addr, args ServingModeChangeArgs) {
Copy link
Member

Choose a reason for hiding this comment

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

Make this a standalone function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

xds/server.go Outdated
//
// Note that this means that `s.opts.modeCallback` will never be nil and can
// safely be invoked directly from `handleServiceModeChanges`.
if so.modeCallback == nil {
Copy link
Member

Choose a reason for hiding this comment

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

Should we have a defaultServerOptions that has this set in it, such that if applying the options doesn't override it, we get the defaults? (e.g. how we handle DialOptions in the grpc package)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@dfawley dfawley assigned easwars and unassigned dfawley Mar 16, 2022
@easwars easwars assigned dfawley and unassigned easwars Mar 16, 2022
@dfawley dfawley assigned easwars and unassigned dfawley Mar 17, 2022
@easwars easwars merged commit f95b001 into grpc:master Mar 17, 2022
@ejona86
Copy link
Member

ejona86 commented Mar 17, 2022

"Suppress redundant mode changes in the listenerWrapper" doesn't sound right. If things are continuing to fail, we need to continue to notify. This is because 1) the error may have changed and 2) it provides a timestamp of the last backoff attempt. The only time to "suppress redundant mode changes" is in the successful case where we are listening and the new mode is still listening.

@easwars easwars deleted the xds_serving_mode_log_spam branch March 21, 2022 21:18
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

xDS server spams mode "switches"

3 participants