Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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