Skip to content

Commit 20629e2

Browse files
authored
Merge pull request #2993 from devspace-sh/DSP-137
Removes call to SetDefaultScheme, which is not thread safe.
2 parents 156652d + 9c52741 commit 20629e2

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

helper/util/conn.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,20 @@ import (
44
"context"
55
"io"
66
"net"
7-
7+
88
"google.golang.org/grpc"
99
"google.golang.org/grpc/credentials/insecure"
10-
"google.golang.org/grpc/resolver"
1110
)
1211

1312
// NewClientConnection creates a new client connection for the given reader and writer
1413
func NewClientConnection(reader io.Reader, writer io.Writer) (*grpc.ClientConn, error) {
1514
pipe := NewStdStreamJoint(reader, writer, false)
16-
17-
resolver.SetDefaultScheme("passthrough")
15+
1816
// Set up a connection to the server.
19-
return grpc.NewClient("",
17+
return grpc.NewClient("passthrough:///",
2018
grpc.WithTransportCredentials(insecure.NewCredentials()),
2119
grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) {
2220
return pipe, nil
2321
}),
24-
grpc.WithLocalDNSResolution(),
25-
grpc.WithDefaultCallOptions())
22+
grpc.WithLocalDNSResolution())
2623
}

pkg/devspace/services/sync/controller.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import (
55
"bytes"
66
"context"
77
"fmt"
8-
"github.com/loft-sh/devspace/pkg/util/tomb"
9-
"github.com/mgutz/ansi"
108
"io"
119
"os"
1210
"path"
@@ -15,6 +13,9 @@ import (
1513
"strings"
1614
"time"
1715

16+
"github.com/loft-sh/devspace/pkg/util/tomb"
17+
"github.com/mgutz/ansi"
18+
1819
"github.com/loft-sh/devspace/pkg/devspace/kubectl/selector"
1920
kerrors "k8s.io/apimachinery/pkg/api/errors"
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -267,9 +268,7 @@ func PrintPodError(ctx context.Context, kubeClient kubectl.Client, pod *v1.Pod,
267268
}
268269

269270
func (c *controller) startSync(ctx devspacecontext.Context, options *Options, onInitUploadDone chan struct{}, onInitDownloadDone chan struct{}, onDone chan struct{}, onError chan error) (*sync.Sync, *selector.SelectedPodContainer, error) {
270-
var (
271-
syncConfig = options.SyncConfig
272-
)
271+
syncConfig := options.SyncConfig
273272

274273
container, err := options.Selector.SelectSingleContainer(ctx.Context(), ctx.KubeClient(), ctx.Log())
275274
if err != nil {
@@ -501,7 +500,7 @@ func (c *controller) initClient(ctx devspacecontext.Context, pod *v1.Pod, arch,
501500
go func() {
502501
err := StartStream(ctx.Context(), ctx.KubeClient(), pod, container, upstreamArgs, upStdinReader, upStdoutWriter, true, options.Log)
503502
if err != nil {
504-
syncClient.Stop(errors.Errorf("Sync - connection lost to pod %s/%s: %v", pod.Namespace, pod.Name, err))
503+
syncClient.Stop(errors.Errorf("Upstream Sync - connection lost to pod %s/%s: %v", pod.Namespace, pod.Name, err))
505504
}
506505
}()
507506

@@ -529,7 +528,7 @@ func (c *controller) initClient(ctx devspacecontext.Context, pod *v1.Pod, arch,
529528
go func() {
530529
err := StartStream(ctx.Context(), ctx.KubeClient(), pod, container, downstreamArgs, downStdinReader, downStdoutWriter, true, options.Log)
531530
if err != nil {
532-
syncClient.Stop(errors.Errorf("Sync - connection lost to pod %s/%s: %v", pod.Namespace, pod.Name, err))
531+
syncClient.Stop(errors.Errorf("Downstream Sync - connection lost to pod %s/%s: %v", pod.Namespace, pod.Name, err))
533532
}
534533
}()
535534

0 commit comments

Comments
 (0)