Skip to content

Don't use WithBlock() on dist gRPC connection#986

Merged
stevvooe merged 1 commit intocontainerd:masterfrom
estesp:non-block-grpc-dist
Jun 9, 2017
Merged

Don't use WithBlock() on dist gRPC connection#986
stevvooe merged 1 commit intocontainerd:masterfrom
estesp:non-block-grpc-dist

Conversation

@estesp
Copy link
Copy Markdown
Member

@estesp estesp commented Jun 9, 2017

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 [email protected]

// cc: @stevvooe per our discussion

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 <[email protected]>
@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #986 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #986   +/-   ##
=======================================
  Coverage   59.05%   59.05%           
=======================================
  Files           5        5           
  Lines         779      779           
=======================================
  Hits          460      460           
  Misses        205      205           
  Partials      114      114

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update beaff3d...9f028b5. Read the comment docs.

@crosbymichael
Copy link
Copy Markdown
Member

LGTM

@mlaventure
Copy link
Copy Markdown
Contributor

In this case, the timeout doesn't have any effect according to the doc:

// WithTimeout returns a DialOption that configures a timeout for dialing a ClientConn
// initially. This is valid if and only if WithBlock() is present.

@estesp
Copy link
Copy Markdown
Member Author

estesp commented Jun 9, 2017

@mlaventure hmm, does seem to be the case. That means all the WithTimeout() usage everywhere else in the code is ineffective :-]

@dmcgowan
Copy link
Copy Markdown
Member

dmcgowan commented Jun 9, 2017

LGTM

I agree with @estesp, no point in having WithTimeout() then if we don't have WithBlock()

@mlaventure
Copy link
Copy Markdown
Contributor

wouldn't that mean that if I do:

  • start containerd
  • invoke a RPC

There's a chance that it fails directly? because the server just wasn't ready in time?

@estesp
Copy link
Copy Markdown
Member Author

estesp commented Jun 9, 2017

Reading through this code for the first time, so not fully sure, but looks like:

	// minimum time to give a connection to complete
	minConnectTimeout = 20 * time.Second

is used even without the WithBlock() case; so you at least get 20 seconds.

EDIT: Specifically here if I'm following the non-blocking path correctly.

@stevvooe
Copy link
Copy Markdown
Member

stevvooe commented Jun 9, 2017

LGTM

Merging this one, for now. Let's have another PR to handle the timeout.

@stevvooe stevvooe merged commit 7759386 into containerd:master Jun 9, 2017
@estesp estesp deleted the non-block-grpc-dist branch June 9, 2017 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants