check for context deadline exceeded in retry client (#2033)

you can get a context deadline exceeded from clientv3 if there's heavy load and the
etcd server sends a grpc code DeadlineExceeded. this causes the etcd client to not
retry connecting and then you end up with nodes that can't recover.

Co-authored-by: tgruben <tgruben@gmail.com>
Co-authored-by: 54mir <48686912+54mir@users.noreply.github.com>
Co-authored-by: seebs <seebs@molecula.com>

Co-authored-by: tgruben <tgruben@gmail.com>
Co-authored-by: 54mir <48686912+54mir@users.noreply.github.com>
Co-authored-by: seebs <seebs@molecula.com>
This commit is contained in:
reesporte 2022-04-25 14:23:27 -05:00 • committed by GitHub
parent 8702fac11d
commit 0e37e04f47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -225,7 +225,8 @@ func (e *Etcd) retryClient(fn func(cli *clientv3.Client) error) (err error) {
cli = e.newClient(cli)
break
}
if !strings.Contains(msg, "etcdserver: request timed out") {
// check that the request hasn't timed out. this can happen with either of these errors
if !strings.Contains(msg, "etcdserver: request timed out") && !strings.Contains(msg, "context deadline exceeded") {
// not a known error, also not a wrapped timeout
return errors.Wrap(err, "non-retryable error")
}