Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xds: Include unknown type in channel logger warning #9814

Merged
merged 1 commit into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
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
12 changes: 9 additions & 3 deletions xds/src/main/java/io/grpc/xds/AbstractXdsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,12 @@ final void sendDiscoveryRequest(XdsResourceType<?> type, Collection<String> reso

final void handleRpcResponse(XdsResourceType<?> type, String versionInfo, List<Any> resources,
String nonce) {
checkNotNull(type, "type");
if (closed) {
return;
}
responseReceived = true;
if (type != null) {
respNonces.put(type, nonce);
}
respNonces.put(type, nonce);
xdsResponseHandler.handleResourceResponse(type, serverInfo, versionInfo, resources, nonce);
}

Expand Down Expand Up @@ -391,6 +390,13 @@ public void run() {
XdsLogLevel.DEBUG, "Received {0} response:\n{1}", type,
MessagePrinter.print(response));
}
if (type == null) {
logger.log(
XdsLogLevel.WARNING,
"Ignore an unknown type of DiscoveryResponse: {0}",
response.getTypeUrl());
return;
}
handleRpcResponse(type, response.getVersionInfo(), response.getResourcesList(),
response.getNonce());
}
Expand Down
5 changes: 1 addition & 4 deletions xds/src/main/java/io/grpc/xds/XdsClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,8 @@ private void maybeCreateXdsChannelWithLrs(ServerInfo serverInfo) {
public void handleResourceResponse(
XdsResourceType<?> xdsResourceType, ServerInfo serverInfo, String versionInfo,
List<Any> resources, String nonce) {
checkNotNull(xdsResourceType, "xdsResourceType");
syncContext.throwIfNotInThisSynchronizationContext();
if (xdsResourceType == null) {
logger.log(XdsLogLevel.WARNING, "Ignore an unknown type of DiscoveryResponse");
return;
}
Set<String> toParseResourceNames = null;
if (!(xdsResourceType == XdsListenerResource.getInstance()
|| xdsResourceType == XdsRouteConfigureResource.getInstance())
Expand Down