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 race condition #552

Merged
merged 2 commits into from
Nov 9, 2023
Merged

Fix race condition #552

merged 2 commits into from
Nov 9, 2023

Conversation

yalosev
Copy link
Contributor

@yalosev yalosev commented Nov 9, 2023

Overview

Fix race

What this PR does / why we need it

We have a race here:

WARNING: DATA RACE
Read at 0x00c0064351e8 by goroutine 72:
  github.com/flant/shell-operator/pkg/task.(*BaseTask).GetMetadata()
      /go/pkg/mod/github.com/flant/[email protected]/pkg/task/task.go:100 +0x37
  github.com/flant/addon-operator/pkg/task.HookMetadataAccessor()
      /go/pkg/mod/github.com/flant/[email protected]/pkg/task/hook_metadata.go:48 +0x88
  github.com/flant/addon-operator/pkg/addon-operator.taskDescriptionForTaskFlowLog()
      /go/pkg/mod/github.com/flant/[email protected]/pkg/addon-operator/operator.go:2040 +0x8a
  github.com/flant/addon-operator/pkg/addon-operator.(*AddonOperator).logTaskAdd()
      /go/pkg/mod/github.com/flant/[email protected]/pkg/addon-operator/operator.go:2146 +0x197
  github.com/flant/addon-operator/pkg/addon-operator.(*AddonOperator).HandleModuleRun()
      /go/pkg/mod/github.com/flant/[email protected]/pkg/addon-operator/operator.go:1398 +0x19cd
  github.com/flant/addon-operator/pkg/addon-operator.(*AddonOperator).TaskHandler()
      /go/pkg/mod/github.com/flant/[email protected]/pkg/addon-operator/operator.go:983 +0x26a
  github.com/flant/addon-operator/pkg/addon-operator.(*AddonOperator).TaskHandler-fm()
      <autogenerated>:1 +0xaf
  github.com/flant/shell-operator/pkg/task/queue.(*TaskQueue).Start.func1()
      /go/pkg/mod/github.com/flant/[email protected]/pkg/task/queue/task_queue.go:406 +0x41e

Previous write at 0x00c0064351e8 by goroutine 2688:
  github.com/flant/shell-operator/pkg/task.(*BaseTask).UpdateMetadata()
      /go/pkg/mod/github.com/flant/[email protected]/pkg/task/task.go:104 +0x44
  github.com/flant/addon-operator/pkg/addon-operator.(*AddonOperator).HandleModuleHookRun()
      /go/pkg/mod/github.com/flant/[email protected]/pkg/addon-operator/operator.go:1575 +0x1111
  github.com/flant/addon-operator/pkg/addon-operator.(*AddonOperator).TaskHandler()
      /go/pkg/mod/github.com/flant/[email protected]/pkg/addon-operator/operator.go:989 +0x4ca

Special notes for your reviewer

@yalosev yalosev added bug Something isn't working go Pull requests that update Go code labels Nov 9, 2023
@yalosev yalosev requested a review from nabokihms November 9, 2023 14:16
@yalosev yalosev merged commit fc5d159 into main Nov 9, 2023
18 checks passed
@yalosev yalosev deleted the fix-race branch November 9, 2023 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants