Skip to content

Commit 20aebe7

Browse files
committed
Add resolver workaround for error: name resolver error: produced zero addresses
Signed-off-by: Maksym Pavlenko <[email protected]>
1 parent 564c8bf commit 20aebe7

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

client/client.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@ import (
2121
"context"
2222
"encoding/json"
2323
"fmt"
24+
"runtime"
2425
"strconv"
2526
"strings"
2627
"sync"
2728
"time"
2829

30+
"google.golang.org/grpc/resolver"
31+
2932
containersapi "github.com/containerd/containerd/api/services/containers/v1"
3033
diffapi "github.com/containerd/containerd/api/services/diff/v1"
3134
imagesapi "github.com/containerd/containerd/api/services/images/v1"
@@ -80,6 +83,14 @@ func init() {
8083
typeurl.Register(&specs.LinuxResources{}, prefix, "opencontainers/runtime-spec", major, "LinuxResources")
8184
typeurl.Register(&specs.WindowsResources{}, prefix, "opencontainers/runtime-spec", major, "WindowsResources")
8285
typeurl.Register(&features.Features{}, prefix, "opencontainers/runtime-spec", major, "features", "Features")
86+
87+
if runtime.GOOS == "windows" {
88+
// After bumping GRPC to 1.64, Windows tests started failing with: "name resolver error: produced zero addresses".
89+
// This is happening because grpc.NewClient uses DNS resolver by default, which apparently not what we want
90+
// when using socket paths on Windows.
91+
// Using a workaround from https://github.com/grpc/grpc-go/issues/1786#issuecomment-2119088770
92+
resolver.SetDefaultScheme("passthrough")
93+
}
8394
}
8495

8596
// New returns a new containerd client that is connected to the containerd

0 commit comments

Comments
 (0)