envoyproxy / envoyproxy/java-control-plane

lost watch when client send two request without nonce

未关闭
#222 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
312
派生
149
PR 合并指标
30 天内没有已合并 PR

描述

log

```
[2022-04-25 19:13:25.993] [DEBUG] [grpc-default-executor-0] [i.e.controlplane.server.OspDiscoveryServer] >>> [0] open stream from
[2022-04-25 19:13:26.009] [DEBUG] [grpc-default-executor-0] [i.e.controlplane.server.OspDiscoveryServer] >>> [0] request type.googleapis.com/envoy.api.v2.ClusterLoadAssignment[r1] with nonce from version 3
[2022-04-25 19:13:26.684] [DEBUG] [grpc-default-executor-0] [i.e.controlplane.server.OspDiscoveryServer] >>> [0] response type.googleapis.com/envoy.api.v2.ClusterLoadAssignment with nonce 0 version 0
[2022-04-25 19:13:26.696] [DEBUG] [grpc-default-executor-0] [i.e.controlplane.server.OspDiscoveryServer] >>> [0] request type.googleapis.com/envoy.api.v2.ClusterLoadAssignment[r1, r2, r3, r4] with nonce from version 3
```

When I restart xds server, C++ client will send two request without nonce for one resourceType, xds server response first request, then handle the second request.

In the code, xds server will discard the second request, watch resources in second request will lost.

```
LatestDiscoveryResponse latestDiscoveryResponse = latestResponse(requestTypeUrl);
String resourceNonce = latestDiscoveryResponse == null ? null : latestDiscoveryResponse.nonce();

if (isNullOrEmpty(resourceNonce) || resourceNonce.equals(nonce)) {
if (!request.hasErrorDetail() && latestDiscoveryResponse != null) {
setAckedResources(requestTypeUrl, latestDiscoveryResponse.resourceNames());
}

computeWatch(requestTypeUrl, () -> discoveryServer.configWatcher.createWatch(
ads(),
request,
ackedResources(requestTypeUrl),
r -> executor.execute(() -> send(r, requestTypeUrl)),
hasClusterChanged
));
}
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。