Skip to content

Commit

Permalink
Removed description from Status.OK, as it was not used
Browse files Browse the repository at this point in the history
  • Loading branch information
DNVindhya committed Oct 8, 2024
1 parent c8cd25d commit 439f81a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
11 changes: 4 additions & 7 deletions xds/src/main/java/io/grpc/xds/client/ControlPlaneClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@
*/
final class ControlPlaneClient {

public static final String CLOSED_BY_SERVER_AFTER_RECEIVING_A_RESPONSE =
"Closed by server after receiving a response";
private final SynchronizationContext syncContext;
private final InternalLogId logId;
private final XdsLogger logger;
Expand Down Expand Up @@ -401,21 +399,20 @@ private void handleRpcStreamClosed(Status status) {
// close streams for various reasons during normal operation, such as load balancing or
// underlying connection hitting its max connection age limit (see gRFC A9).
if (!status.isOk()) {
newStatus = Status.OK.withDescription(
CLOSED_BY_SERVER_AFTER_RECEIVING_A_RESPONSE);
newStatus = Status.OK;
logger.log( XdsLogLevel.DEBUG, "ADS stream closed with error {0}: {1}. However, a "
+ "response was received, so this will not be treated as an error. Cause: {2}.",
+ "response was received, so this will not be treated as an error. Cause: {2}",
status.getCode(), status.getDescription(), status.getCause());
} else {
logger.log(XdsLogLevel.DEBUG,
"ADS stream closed by server after responses received.");
"ADS stream closed by server after a response was received");
}
} else {
// If the ADS stream is closed without ever having received a response from the server, then
// the XdsClient should consider that a connectivity error (see gRFC A57).
if (status.isOk()) {
newStatus = Status.UNAVAILABLE.withDescription(
"ADS stream failed, because connection was closed before receiving a response.");
"ADS stream closed with OK before receiving a response");
}
logger.log(
XdsLogLevel.ERROR, "ADS stream failed with status {0}: {1}. Cause: {2}",
Expand Down
2 changes: 0 additions & 2 deletions xds/src/main/java/io/grpc/xds/client/XdsClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ public void handleResourceResponse(
public void handleStreamClosed(Status error) {
syncContext.throwIfNotInThisSynchronizationContext();
cleanUpResourceTimers();
// Resource subscribers are not notified when the server closes the stream after a
// response is received.
if (!error.isOk()) {
for (Map<String, ResourceSubscriber<? extends ResourceUpdate>> subscriberMap :
resourceSubscribers.values()) {
Expand Down
4 changes: 2 additions & 2 deletions xds/src/test/java/io/grpc/xds/GrpcXdsClientImplTestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -3342,10 +3342,10 @@ public void streamClosedWithNoResponse() {
verify(ldsResourceWatcher, Mockito.timeout(1000).times(1))
.onError(errorCaptor.capture());
verifyStatusWithNodeId(errorCaptor.getValue(), Code.UNAVAILABLE,
"ADS stream failed, because connection was closed before receiving a response.");
"ADS stream closed with OK before receiving a response");
verify(rdsResourceWatcher).onError(errorCaptor.capture());
verifyStatusWithNodeId(errorCaptor.getValue(), Code.UNAVAILABLE,
"ADS stream failed, because connection was closed before receiving a response.");
"ADS stream closed with OK before receiving a response");
}

@Test
Expand Down

0 comments on commit 439f81a

Please sign in to comment.