From 73d28ddeb27a5532df084035199c9ad5ed2f69fe Mon Sep 17 00:00:00 2001 From: Kazuyoshi Kato Date: Mon, 3 Aug 2020 13:08:28 -0700 Subject: [PATCH] client: surface a connection error more clearly gRPC-Go recently added grpc.WithReturnConnectionError() which improves the situation of #2576. Permission errors: % ./bin/ctr t ls ctr: failed to dial "/run/containerd/containerd.sock": connection error: desc = "transport: error while dialing: dial unix /run/containerd/containerd.sock: connect: permission denied" % Non-existent sockets: % ./bin/ctr -a notfound t ls ctr: failed to dial "notfound": context deadline exceeded: connection error: desc = "transport: error while dialing: dial unix://notfound: timeout" % Signed-off-by: Kazuyoshi Kato --- client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/client.go b/client.go index ace9bf6d1..02502e5cd 100644 --- a/client.go +++ b/client.go @@ -123,6 +123,7 @@ func New(address string, opts ...ClientOpt) (*Client, error) { grpc.FailOnNonTempDialError(true), grpc.WithConnectParams(connParams), grpc.WithContextDialer(dialer.ContextDialer), + grpc.WithReturnConnectionError(), // TODO(stevvooe): We may need to allow configuration of this on the client. grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(defaults.DefaultMaxRecvMsgSize)),