Don't use WithBlock() on dist gRPC connection

When using WithBlock() on the dialer, the connection timeout must fully
expire before any status is provided to the user about whether they can
even connect to the socket. For example, if the containerd socket is
root-owned and the user tries `dist images ls` without `sudo`, the
default is 30 sec. of "hang" before the command returns.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
This commit is contained in:
Phil Estes 2017-06-09 15:40:14 -04:00
parent beaff3d81d
commit 9f028b50cb
No known key found for this signature in database
GPG Key ID: 0F386284C03A1162

1
cmd/dist/common.go vendored
View File

@ -102,7 +102,6 @@ func connectGRPC(context *cli.Context) (*grpc.ClientConn, error) {
timeout := context.GlobalDuration("connect-timeout")
return grpc.Dial(address,
grpc.WithTimeout(timeout),
grpc.WithBlock(),
grpc.WithInsecure(),
grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
return net.DialTimeout("unix", address, timeout)