Skip to content

Commit

Permalink
xds: Squelch ADS reconnection error logs
Browse files Browse the repository at this point in the history
Workaround for #8886, as we wait on a real fix. The regular load
balancing disconnections are confusing users and will train users to
start ignoring gRPC warnings. At present, it is better to have no log
than excessively log.
  • Loading branch information
ejona86 committed Feb 24, 2022
1 parent b77bc6b commit 1b1b284
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions xds/src/main/java/io/grpc/xds/XdsNameResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ final class XdsNameResolver extends NameResolver {
private XdsClient xdsClient;
private CallCounterProvider callCounterProvider;
private ResolveState resolveState;
// Workaround for https://github.com/grpc/grpc-java/issues/8886 . This should be handled in
// XdsClient instead of here.
private boolean receivedConfig;

XdsNameResolver(
@Nullable String targetAuthority, String name, ServiceConfigParser serviceConfigParser,
Expand Down Expand Up @@ -293,6 +296,7 @@ private void updateResolutionResult() {
.setServiceConfig(parsedServiceConfig)
.build();
listener.onResult(result);
receivedConfig = true;
}

@VisibleForTesting
Expand Down Expand Up @@ -715,7 +719,7 @@ public void onError(final Status error) {
syncContext.execute(new Runnable() {
@Override
public void run() {
if (stopped) {
if (stopped || receivedConfig) {
return;
}
listener.onError(error);
Expand Down Expand Up @@ -865,6 +869,7 @@ private void cleanUpRoutes() {
}
routingConfig = RoutingConfig.empty;
listener.onResult(emptyResult);
receivedConfig = true;
}

private void cleanUpRouteDiscoveryState() {
Expand Down Expand Up @@ -912,7 +917,7 @@ public void onError(final Status error) {
syncContext.execute(new Runnable() {
@Override
public void run() {
if (RouteDiscoveryState.this != routeDiscoveryState) {
if (RouteDiscoveryState.this != routeDiscoveryState || receivedConfig) {
return;
}
listener.onError(error);
Expand Down

0 comments on commit 1b1b284

Please sign in to comment.