From 640caeb74f2bc5e93b1579a10d6d04a07863379f Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Thu, 24 Jan 2019 09:59:33 -0500 Subject: [PATCH] Add the http2 GOAWAY error to IsProbableEOF for ignoring in watch http2 is allowed to tell us to go away, and for watch it is safe to exit and restart in almost all cases where a connection is forcibly closed by the upstream. This error message happens a lot behind ELB and other http2 aware proxies. Treat the error as "basically done" as suggested by https://github.com/golang/go/issues/18639#issuecomment-285515534 --- staging/src/k8s.io/apimachinery/pkg/util/net/http.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/staging/src/k8s.io/apimachinery/pkg/util/net/http.go b/staging/src/k8s.io/apimachinery/pkg/util/net/http.go index 155667cdfc7..078f00d9b97 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/net/http.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/net/http.go @@ -68,14 +68,17 @@ func IsProbableEOF(err error) bool { if uerr, ok := err.(*url.Error); ok { err = uerr.Err } + msg := err.Error() switch { case err == io.EOF: return true - case err.Error() == "http: can't write HTTP request on broken connection": + case msg == "http: can't write HTTP request on broken connection": return true - case strings.Contains(err.Error(), "connection reset by peer"): + case strings.Contains(msg, "http2: server sent GOAWAY and closed the connection"): return true - case strings.Contains(strings.ToLower(err.Error()), "use of closed network connection"): + case strings.Contains(msg, "connection reset by peer"): + return true + case strings.Contains(strings.ToLower(msg), "use of closed network connection"): return true } return false