From 35182852db73a3b9730bb509400f12cd79d59e95 Mon Sep 17 00:00:00 2001 From: Peter Mattis Date: Tue, 9 Aug 2016 16:32:41 -0400 Subject: [PATCH] Retry transport creation when ClientHandshake returns EOF ClientHandshake performs the first IO on the connection and can give us the first indication that the connection was closed. Making any error from ClientHandshake a non-temporary error causes grpc.Invoke to not retry a non-failfast RPC. See https://github.com/cockroachdb/cockroach/issues/8353. --- transport/http2_client.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/transport/http2_client.go b/transport/http2_client.go index 9a8384ee..85a0097f 100644 --- a/transport/http2_client.go +++ b/transport/http2_client.go @@ -129,8 +129,9 @@ func newHTTP2Client(ctx context.Context, addr string, opts ConnectOptions) (_ Cl conn, authInfo, connErr = creds.ClientHandshake(ctx, addr, conn) } if connErr != nil { - // Credentials handshake error is not a temporary error. - return nil, ConnectionErrorf(false, connErr, "transport: %v", connErr) + // Credentials handshake error is not a temporary error (unless the error + // was the connection closing). + return nil, ConnectionErrorf(connErr == io.EOF, connErr, "transport: %v", connErr) } defer func() { if err != nil {