You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The shift to grpc.NewClient makes the gRPC connection "lazy" - it isn't performed at the time the client is being created, it's deferred to a later time where an actual RPC is performed.
This makes the containerd.WithTimeout useless, because it only worked for the initial connection, and not all connections dialed throughout the whole lifecycle of the containerd client.
The timeout was first introduced in #2554 - however I'm not able to determine whether it was intentional that it only applies to the initial connection. This is where I need your input, because we have two options depending on this decision :)
Deprecate/remove WithTimeout because there's no initial connection anymore
On the other hand, there's also a question of whether the new behavior of client.New should produce such "lazily" initialized client, instead of verifying that at least the initial connection is performed successfully.
Looking at the godoc:
// New returns a new containerd client that is connected to the containerd// instance provided by addressfuncNew(addressstring, opts...Opt) (*Client, error) {
The that is connected to the containerd instance sounds like that function should at least make sure that there's a containerd instance listening on the provided address.
Currently, on the v2 client this behavior isn't really consistent, because it depends on whether the default namespace was specified or not (client.WithDefaultNamespace):
Description
containerd.WithTimeoutdoesn't work on containerd v2 client and returns immediately if the connection can't be established.This is a consequence of moving from
grpc.DialContexttogrpc.NewClientand dropping the usage ofWithBlock: 63b4688.The former attempts the connection immediately, and the
WithBlockblocks until the connection is ready.As explained in https://github.com/grpc/grpc-go/blob/master/Documentation/anti-patterns.md - this is considered as an anti-pattern because one can't assume that the connection would still be available later.
The shift to
grpc.NewClientmakes the gRPC connection "lazy" - it isn't performed at the time the client is being created, it's deferred to a later time where an actual RPC is performed.This makes the
containerd.WithTimeoutuseless, because it only worked for the initial connection, and not all connections dialed throughout the whole lifecycle of the containerd client.The timeout was first introduced in #2554 - however I'm not able to determine whether it was intentional that it only applies to the initial connection. This is where I need your input, because we have two options depending on this decision :)
WithTimeoutbecause there's no initial connection anymoreclient.WithTimeoutoption #11508On the other hand, there's also a question of whether the new behavior of
client.Newshould produce such "lazily" initialized client, instead of verifying that at least the initial connection is performed successfully.Looking at the godoc:
The
that is connected to the containerd instancesounds like that function should at least make sure that there's a containerd instance listening on the provided address.Currently, on the v2 client this behavior isn't really consistent, because it depends on whether the default namespace was specified or not (
client.WithDefaultNamespace):containerd/client/client.go
Lines 173 to 180 in c63d132
If it was, then the client will attempt to query the daemon for the default runtime label which effectively "unlazies" the client.
We should decide whether the
client.Newshould produce an "unlazied" connection and if so - encode that explicitly.Steps to reproduce the issue
Describe the results you received and expected
Got:
Expected the second test to pass (retry the connection for at least 10 seconds).
What version of containerd are you using?
v2.0.3 and v1.7.26
Any other relevant information
No response
Show configuration if it is related to CRI plugin.
No response