devspace-sh / devspace

DevSpace - The Fastest Developer Tool for Kubernetes ⚡ Automate your deployment workflow with DevSpace and develop software directly inside Kubernetes.
https://devspace.sh
Apache License 2.0
4.29k stars 359 forks source link

Concurrency: true = failed deploy #1917

Closed Tsopic closed 1 year ago

Tsopic commented 2 years ago

What happened? Deployment failed

What did you expect to happen instead? Expected successful deployment

How can we reproduce the bug? (as minimally and precisely as possible) Set multiple deployments to be deployed concurrently.

Add concurrent: true on deployment description.

Local Environment: devspace version: 5.18.4

Kubernetes Cluster:

Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.4", GitCommit:"b695d79d4f967c403a96986f1750a35eb75e75f1", GitTreeState:"clean", BuildDate:"2021-11-17T15:48:33Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.6-gke.1500", GitCommit:"7ce0f9f1939dfc1aee910732e84cba03840df91e", GitTreeState:"clean", BuildDate:"2021-11-17T09:30:26Z", GoVersion:"go1.16.9b7", Compiler:"gc", Platform:"linux/amd64"}

Anything else we need to know?

[wait] ⠴ Deploying 4 deployments concurrently (0s)fatal error: concurrent map writes

goroutine 123 [running]:
runtime.throw({0x5bf4131, 0x60})
        /Users/runner/hostedtoolcache/go/1.17.7/x64/src/runtime/panic.go:1198 +0x71 fp=0xc0011ad510 sp=0xc0011ad4e0 pc=0x4037191
runtime.mapassign_faststr(0x582fe20, 0xc000209b60, {0xc0018b0360, 0xe})
        /Users/runner/hostedtoolcache/go/1.17.7/x64/src/runtime/map_faststr.go:211 +0x39c fp=0xc0011ad578 sp=0xc0011ad510 pc=0x4015d3c
github.com/loft-sh/devspace/pkg/devspace/config/generated.(*CacheConfig).GetDeploymentCache(...)
        /Users/runner/work/devspace/devspace/pkg/devspace/config/generated/config.go:206
github.com/loft-sh/devspace/pkg/devspace/deploy/deployer/kubectl.(*DeployConfig).Deploy(0xc001876480, 0xc0, 0xc001b9c240)
        /Users/runner/work/devspace/devspace/pkg/devspace/deploy/deployer/kubectl/kubectl.go:178 +0xf3 fp=0xc0011ad758 sp=0xc0011ad578 pc=0x54962d3
github.com/loft-sh/devspace/pkg/devspace/deploy.(*controller).deployOne(0xc001b9c040, 0xc0017c1a80, {0x6009600, 0xc00116cdc0}, 0xc001b92c90, 0xc001b92cc0)
        /Users/runner/work/devspace/devspace/pkg/devspace/deploy/deploy.go:308 +0x6f5 fp=0xc0011adeb8 sp=0xc0011ad758 pc=0x549a2b5
github.com/loft-sh/devspace/pkg/devspace/deploy.(*controller).Deploy.func1(0xc0017c1a80, 0x3)
        /Users/runner/work/devspace/devspace/pkg/devspace/deploy/deploy.go:205 +0x3f4 fp=0xc0011adfc0 sp=0xc0

/kind bug

FabianKramm commented 2 years ago

@Tsopic thanks for creating this issue! Seems like the deployments try to update the local cache concurrently which is why this fails. We'll issue a fix for this soon

FabianKramm commented 1 year ago

@Tsopic should be fixed with DevSpace v6