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.
This commit is contained in:
Peter Mattis
2016-08-09 16:32:41 -04:00
parent 35896af9ad
commit 35182852db

View File

@ -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 {