devspace icon indicating copy to clipboard operation
devspace copied to clipboard

`devspace dev` syncs wrong folder on connection lost (broken pipe on vcluster connect)

Open sandrotaje opened this issue 3 years ago • 3 comments

What happened? Sometimes it happens devspace syncs folders outside of the folder where devspace is defined. Specifically it happens when the vcluster connect returns a "Broken pipe" error.

We have a monorepository with a "root" devspace where there are defined just dependencies and every dependency is inside a subfolder of the same repo.

Inside the devspace of a dependency we have something like this:

  sync:
      localSubPath: ../../

Because we need to sync also other folders that contain some common modules. We are using vcluster connect to connect to the virtual cluster through the port-forward.

This works almost every time but sometimes ( it seems when the vcluster connect returns a broken pipe error) devspace dev starts to sync ../../ not relative to the devspace file but from the root of the repository ending up in syncing files not related causing a slow down of the computer and of the cluster.

Handling connection for 10195
Handling connection for 10195
an error occurred forwarding 10195 -> 8443: error forwarding port 8443 to pod 1a2745596017f692dd07236f87b1351cf472dea3537ab9b8f117d1564bdc0ec7, uid : exit status 1: 2022/09/15 12:11:21 socat[5277] E write(5, 0x55b70fcd6f60, 76): Broken pipe

What did you expect to happen instead? Just continue to sync the correct folder

How can we reproduce the bug? (as minimally and precisely as possible) I'm not sure on how to have the broken pipe error, I tried shutting down the internet connection but it doesn't seem to happen.

My root devspace.yaml:

version: v1beta11

deployments:
- name: main
  helm:
    chart:
      name: ...
      version: 0.1.2
    values:
      metadata:
        name: ...
        version: 0.0.1

dependencies:
  - name: ...
    vars:
      - name: NAME
        value: ...
      - name: PORT
        value: ...
    source:
      path: ./folder/folder
    dev:
      ports: true
      sync: true
      replacePods: true
  - name: ...
    vars:
      - name: NAME
        value: ...
      - name: PORT
        value: ..
      - name: HOST
        value: ...
    source:
      path: ./folder/folder
    dev:
      ports: true
      sync: true
      replacePods: true
  - name: ...
    vars:
      - name: NAME
        value: ...
      - name: PORT
        value: ...
    source:
      path: ./folder
    dev:
      ports: true
      sync: true
      replacePods: true

One of the dependency devspace:

version: v1beta11

commands:
  - name: start
    command: ....
  - name: linting
    command: echo running frontend linting...
  - name: test
    command: echo running frontend test...

deployments:
  - name: ${NAME}
    helm:
      chart:
        name: ...
        version: ...
      values:
....

dev:
  ports:
    - labelSelector:
        app.kubernetes.io/component: ${NAME}
      forward:
        - port: ${PORT}
  sync:
    - name: ${NAME}
      labelSelector:
        app.kubernetes.io/component: ${NAME}
      localSubPath: ../../
      disableDownload: true
      uploadExcludePaths:
        - bin/
        - obj/
        - node_modules/
  replacePods:
    - labelSelector:
        app.kubernetes.io/component: ${NAME}
      patches:
        - op: replace
          path: spec.containers[0].command
          value:
            - sleep
        - op: replace
          path: spec.containers[0].args
          value:
            - "9999999"
        - op: remove
          path: spec.containers[0].securityContext

Local Environment:

  • DevSpace Version: 5.18.5
  • Operating System: mac
  • ARCH of the OS: AMD64 Kubernetes Cluster:
  • Cloud Provider: aws but with a virtual cluster
  • Kubernetes Version:
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.5", GitCommit:"e338cf2c6d297aa603b50ad3a301f761b4173aa6", GitTreeState:"clean", BuildDate:"2020-12-09T11:18:51Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.15+k3s1", GitCommit:"c7a91e1ccdace64eae4a41b9dc15ef8d7aed6d23", GitTreeState:"clean", BuildDate:"2022-01-25T00:24:54Z", GoVersion:"go1.15.15", Compiler:"gc", Platform:"linux/amd64"}

Anything else we need to know? It happens in different PCs and in different networks not just in my mac or just with my network connection

/kind bug

sandrotaje avatar Sep 15 '22 12:09 sandrotaje

@sandrotaje thanks for reporting this issue! We'll take a look and try to reproduce this problem.

FabianKramm avatar Sep 16 '22 07:09 FabianKramm

Additional info: It seems the bug happens after devspace dev returns `Context deadline exceeded. Unfortunately, I'm not able to print the log.

sandrotaje avatar Sep 16 '22 08:09 sandrotaje

It seems this doesn't happen with devspace 6

sandrotaje avatar Sep 27 '22 18:09 sandrotaje