envoyproxy / envoyproxy/java-control-plane

lost watch when client send two request without nonce

Aperta
#222 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
312
Fork
149
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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
));
}
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.