Skip to content

pkg/clustermesh: protect tests against concurrent access#11852

Merged
borkmann merged 1 commit intomasterfrom
pr/fix-datarace-clustermesh
Jun 3, 2020
Merged

pkg/clustermesh: protect tests against concurrent access#11852
borkmann merged 1 commit intomasterfrom
pr/fix-datarace-clustermesh

Conversation

@aanm
Copy link
Copy Markdown
Member

@aanm aanm commented Jun 3, 2020

The map should also be protected against concurrent access

Fixes: 076b018 ("Inter cluster connectivity (ClusterMesh)")
Signed-off-by: André Martins andre@cilium.io

Fixes:

WARNING: DATA RACE
Write at 0x00c000bbbad0 by goroutine 165:
  runtime.mapdelete_faststr()
      /home/travis/.gimme/versions/go1.14.3.linux.amd64/src/runtime/map_faststr.go:297 +0x0
  github.com/cilium/cilium/pkg/clustermesh.(*ClusterMesh).remove()
      /home/travis/gopath/src/github.com/cilium/cilium/pkg/clustermesh/clustermesh.go:185 +0x341
  github.com/cilium/cilium/pkg/clustermesh.(*configDirectoryWatcher).watch.func1()
      /home/travis/gopath/src/github.com/cilium/cilium/pkg/clustermesh/config.go:106 +0x8d6
Previous read at 0x00c000bbbad0 by goroutine 101:
  github.com/cilium/cilium/pkg/clustermesh.(*ClusterMeshTestSuite).TestWatchConfigDirectory.func3()
      /home/travis/gopath/src/github.com/cilium/cilium/pkg/clustermesh/config_test.go:97 +0x72
  github.com/cilium/cilium/pkg/testutils.WaitUntil()
      /home/travis/gopath/src/github.com/cilium/cilium/pkg/testutils/condition.go:36 +0xf7
  github.com/cilium/cilium/pkg/clustermesh.(*ClusterMeshTestSuite).TestWatchConfigDirectory()
      /home/travis/gopath/src/github.com/cilium/cilium/pkg/clustermesh/config_test.go:97 +0xb6c
  runtime.call32()
      /home/travis/.gimme/versions/go1.14.3.linux.amd64/src/runtime/asm_amd64.s:539 +0x3a
  reflect.Value.Call()
      /home/travis/.gimme/versions/go1.14.3.linux.amd64/src/reflect/value.go:321 +0xd3
  gopkg.in/check%2ev1.(*suiteRunner).forkTest.func1()
      /home/travis/gopath/src/github.com/cilium/cilium/vendor/gopkg.in/check.v1/check.go:781 +0xa0a
  gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
      /home/travis/gopath/src/github.com/cilium/cilium/vendor/gopkg.in/check.v1/check.go:675 +0xd9
Goroutine 165 (running) created at:
  github.com/cilium/cilium/pkg/clustermesh.(*configDirectoryWatcher).watch()
      /home/travis/gopath/src/github.com/cilium/cilium/pkg/clustermesh/config.go:96 +0x392
  github.com/cilium/cilium/pkg/clustermesh.NewClusterMesh()
      /home/travis/gopath/src/github.com/cilium/cilium/pkg/clustermesh/clustermesh.go:120 +0x4c8
  github.com/cilium/cilium/pkg/clustermesh.(*ClusterMeshTestSuite).TestWatchConfigDirectory()
      /home/travis/gopath/src/github.com/cilium/cilium/pkg/clustermesh/config_test.go:77 +0x4ac
  runtime.call32()
      /home/travis/.gimme/versions/go1.14.3.linux.amd64/src/runtime/asm_amd64.s:539 +0x3a
  reflect.Value.Call()
      /home/travis/.gimme/versions/go1.14.3.linux.amd64/src/reflect/value.go:321 +0xd3
  gopkg.in/check%2ev1.(*suiteRunner).forkTest.func1()
      /home/travis/gopath/src/github.com/cilium/cilium/vendor/gopkg.in/check.v1/check.go:781 +0xa0a
  gopkg.in/check%2ev1.(*suiteRunner).forkCall.func1()
      /home/travis/gopath/src/github.com/cilium/cilium/vendor/gopkg.in/check.v1/check.go:675 +0xd9
Goroutine 101 (running) created at:
  gopkg.in/check%2ev1.(*suiteRunner).forkCall()
      /home/travis/gopath/src/github.com/cilium/cilium/vendor/gopkg.in/check.v1/check.go:672 +0x44d
  gopkg.in/check%2ev1.(*suiteRunner).forkTest()
      /home/travis/gopath/src/github.com/cilium/cilium/vendor/gopkg.in/check.v1/check.go:763 +0x1b9
  gopkg.in/check%2ev1.(*suiteRunner).runTest()
      /home/travis/gopath/src/github.com/cilium/cilium/vendor/gopkg.in/check.v1/check.go:818 +0x228
  gopkg.in/check%2ev1.(*suiteRunner).run()
      /home/travis/gopath/src/github.com/cilium/cilium/vendor/gopkg.in/check.v1/check.go:624 +0x1c7
  gopkg.in/check%2ev1.Run()
      /home/travis/gopath/src/github.com/cilium/cilium/vendor/gopkg.in/check.v1/run.go:92 +0x5a
  gopkg.in/check%2ev1.RunAll()
      /home/travis/gopath/src/github.com/cilium/cilium/vendor/gopkg.in/check.v1/run.go:84 +0x127
  gopkg.in/check%2ev1.TestingT()
      /home/travis/gopath/src/github.com/cilium/cilium/vendor/gopkg.in/check.v1/run.go:72 +0x5f6
  github.com/cilium/cilium/pkg/clustermesh.Test()
      /home/travis/gopath/src/github.com/cilium/cilium/pkg/clustermesh/clustermesh_test.go:42 +0x38
  testing.tRunner()
      /home/travis/.gimme/versions/go1.14.3.linux.amd64/src/testing/testing.go:991 +0x1eb

The map should also be protected against concurrent access

Fixes: 076b018 ("Inter cluster connectivity (ClusterMesh)")
Signed-off-by: André Martins <andre@cilium.io>
@aanm aanm added release-note/misc This PR makes changes that have no direct user impact. needs-backport/1.8 labels Jun 3, 2020
@aanm aanm requested a review from a team as a code owner June 3, 2020 09:20
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.008%) to 36.924% when pulling 76be8d2 on pr/fix-datarace-clustermesh into 40b6f58 on master.

@borkmann borkmann merged commit 2dc2023 into master Jun 3, 2020
@borkmann borkmann deleted the pr/fix-datarace-clustermesh branch June 3, 2020 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/misc This PR makes changes that have no direct user impact.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants