openconfig / gnmic

gNMIc is a gNMI CLI client and collector
https://gnmic.openconfig.net
Apache License 2.0
171 stars 55 forks source link

Race condition to use tg.SubscribePoll #353

Closed vincentbernat closed 8 months ago

vincentbernat commented 8 months ago

Hey!

This is difficult to use tg.SubscribePoll() safely as we need to subscribe inside a go routine, then poll only when the goroutine has sufficiently moved forward to register the new subscription.

vincentbernat commented 8 months ago

Also, I am unable to make it work at all:

I am testing on SR Linux.

karimra commented 8 months ago

This is difficult to use tg.SubscribePoll() safely as we need to subscribe inside a go routine, then poll only when the goroutine has sufficiently moved forward to register the new subscription.

The client is supposed to wait for the first sync_update: true. That should indicate that the initial updates have been received.

Also, I am unable to make it work at all:

  • only the first provided path of the subscription is added
  • each call to SubscribePoll() will return a subset of the matching paths
  • once each path has been sent, no new updates are provided

I am testing on SR Linux.

I don't think SR Linux properly supports Poll subscription (or any other router AFIAK). If you want that kind of behavior, you will have better support using subscribe ONCE. Or you can use gNMIc as a proxy.

vincentbernat commented 8 months ago

I don't receive the sync_update message, but you are right that the specification says it should happen. Let's close this issue then.