envoyproxy / java-control-plane

Java implementation of an Envoy gRPC control plane
Apache License 2.0
288 stars 138 forks source link

lose watch when SimpleCache respond return false in respondWithSpecificOrder #219

Open firebook opened 2 years ago

firebook commented 2 years ago

For ADS mode, class io.envoyproxy.controlplane.cache.SimpleCache will respond to client when setSnapshot.

When respond(watch, snapshot, group); return false, respondWithSpecificOrder will lose the watch, since respond is not complete, client will not rewatch

` respond(watch, snapshot, group);

      // Discard the watch. A new watch will be created for future snapshots once envoy ACKs the response.
      return true;

`

staticfinalzero commented 1 month ago

We've also encountered this issue when using gRPC with xDS. If we try to send a gRPC request through to xds:///abc before the SimpleCache has that resource available, subsequent calls to SimpleCache.setSnapshot() will remove the watch preventing gRPC from being notified of later updates to the abc resource.

Per the Envoy specs at https://www.envoyproxy.io/docs/envoy/latest/api-docs/xds_protocol#knowing-when-a-requested-resource-does-not-exist, this should be considered a bug:

Note that even if a requested resource does not exist at the moment when the client requests it, that resource could be created at any time. Management servers must remember the set of resources being requested by the client, and if one of those resources springs into existence later, the server must send an update to the client informing it of the new resource.

I've submitted a pull request here: https://github.com/envoyproxy/java-control-plane/pull/373