Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [TKC-3433] fix fatal error: concurrent map writes #6268

Merged
merged 1 commit into from
Mar 21, 2025
Merged

Conversation

povilasv
Copy link
Contributor

@povilasv povilasv commented Mar 21, 2025

Pull request description

Adds read write mutex to protect the cache, our cloud-api is currently failing with:

{"level":"warn","ts":"2025-03-20T11:34:51Z","caller":"agentserver/agent_stream.go:40","msg":"error getting environment by api key","version":"1.11.18","build":"cloud","service":"AgentServer","error":"record does not exists","errorVerbose":"record does not exists:\n    github.com/kubeshop/testkube-cloud-api/pkg/repository/common.init\n        /app/pkg/repository/common/errors.go:5","obfuscatedKey":"tkcagnt_02**************************bf"}
fatal error: concurrent map writes

goroutine 3400656 [running]:
github.com/kubeshop/testkube/pkg/testworkflows/testworkflowexecutor.(*testWorkflowTemplateFetcher).Prefetch(0xc001cfb830, {0xc004ebd904?, 0x0?})
	/root/.cache/go-build/github.com/kubeshop/[email protected]/pkg/testworkflows/testworkflowexecutor/testworkflowtemplatefetcher.go:53 +0xec
github.com/kubeshop/testkube/pkg/testworkflows/testworkflowexecutor.(*testWorkflowTemplateFetcher).PrefetchMany.(*testWorkflowTemplateFetcher).PrefetchMany.func1.func2()
	/root/.cache/go-build/github.com/kubeshop/[email protected]/pkg/testworkflows/testworkflowexecutor/testworkflowtemplatefetcher.go:70 +0x1f
golang.org/x/sync/errgroup.(*Group).Go.func1()
	/root/.cache/go-build/golang.org/x/[email protected]/errgroup/errgroup.go:78 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 3400649
	/root/.cache/go-build/golang.org/x/[email protected]/errgroup/errgroup.go:75 +0x96

Checklist (choose whats happened)

  • breaking change! (describe)
  • tested locally
  • tested on cluster
  • added new dependencies
  • updated the docs
  • added a test

Breaking changes

Changes

Fixes

@povilasv povilasv marked this pull request as ready for review March 21, 2025 12:01
@povilasv povilasv requested a review from a team as a code owner March 21, 2025 12:01
@povilasv povilasv merged commit 6c50ebc into main Mar 21, 2025
10 checks passed
@povilasv povilasv deleted the TKC-3433 branch March 21, 2025 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants