openconfig / grpctunnel

A TCP-over-gRPC Tunnel
Apache License 2.0
81 stars 24 forks source link

How to avoid `target registration (<target.ID>, <target.Type>) not accepted by server` #67

Closed yhzs8 closed 1 year ago

yhzs8 commented 1 year ago

Version: v0.0.0-20220524190229-125331eabdde

I got this from time to time during the scenario:

Anything I can try to do before client.Register() and client.Start() to get rid of this error?

yhzs8 commented 1 year ago

Update: I printed out the target.Error when the issue happens on this line and it seems the error is originated here

So I will try to remove the targets before adding them back again when the gRPC connection is restored.

yhzs8 commented 1 year ago

Update: the proposal is not working, I did it in the following order:

  1. tunnel.NewClient() with ts set to the targets
  2. client.DeleteTarget() with those targets
  3. client.Start()
  4. blocking wait for client.Error()

for normal cases, step 2 would have failed (there is no target to delete) and it was picked up in 4 and cancelled my workflow. Since all target operations are asynchronous and there is no way to distinguish the error thrown at step 2 and 3 so I cannot swallow the error for step 2 only.

Next proposal: using unique target.ID for subsequent target registrations.