Skip to content

how to handle watch retry #8914

@cnljf

Description

@cnljf

hi:
My env is etcd server:3.2.9 and go client:3.2.9. Use user password auth.
I meet a problem. When I restart a etcd server,the watch channel closed,and I retry to watch without create a new client,the watch cannot success。Here is code:

`
 func() ProcessWatch(wc WatchChan) {
        for resp := range wc {
              if resp.Canceled {
                 log.Log(resp.Err())
              }
              ....
        }

       //retry a new watch
       newWc := Watch(...)
       go ProcessWatch(newWc)
 }
`

1:When the wc closed, the resp.Canceled is not true, so can not log resp.Err().
2: The retry watch will fail, then the retry watch will always try.

Here is tcpdump result:

image

The long link is alive,but there is PermissionDenied Error。

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions