mailgun / holster

A place to keep useful golang functions and small libraries
Apache License 2.0
289 stars 35 forks source link

DATA RACE in holster/discovery #150

Open vtopc opened 1 year ago

vtopc commented 1 year ago
=== RUN   TestSrvResolverBuilderSuccess
==================
WARNING: DATA RACE
Read at 0x00c0003322a8 by goroutine 43:
  github.com/mailgun/holster/v4/discovery_test.TestSrvResolverBuilderSuccess()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver_test.go:82 +0x9f7
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1446 +0x216
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1493 +0x47

Previous write at 0x00c0003322a8 by goroutine 46:
  github.com/mailgun/holster/v4/discovery_test.(*testClientConn).UpdateState()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver_test.go:32 +0xea
  github.com/mailgun/holster/v4/discovery.(*srvResolver).lookupSRV()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver.go:201 +0x688
  github.com/mailgun/holster/v4/discovery.(*srvResolver).watcher()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver.go:117 +0x1b7
  github.com/mailgun/holster/v4/discovery.(*srvResolverBuilder).Build.func1()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver.go:62 +0x39

Goroutine 43 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1493 +0x75d
  testing.runTests.func1()
      /usr/local/go/src/testing/testing.go:1846 +0x99
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1446 +0x216
  testing.runTests()
      /usr/local/go/src/testing/testing.go:1844 +0x7ec
  testing.(*M).Run()
      /usr/local/go/src/testing/testing.go:1726 +0xa84
  main.main()
      _testmain.go:63 +0x2e9

Goroutine 46 (running) created at:
  github.com/mailgun/holster/v4/discovery.(*srvResolverBuilder).Build()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver.go:62 +0x336
  github.com/mailgun/holster/v4/discovery_test.TestSrvResolverBuilderSuccess()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver_test.go:67 +0x836
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1446 +0x216
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1493 +0x47
==================
==================
WARNING: DATA RACE
Read at 0x00c0000ae480 by goroutine 43:
  github.com/mailgun/holster/v4/discovery_test.TestSrvResolverBuilderSuccess()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver_test.go:82 +0xa1b
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1446 +0x216
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1493 +0x47

Previous write at 0x00c0000ae480 by goroutine 46:
  runtime.slicecopy()
      /usr/local/go/src/runtime/slice.go:307 +0x0
  github.com/mailgun/holster/v4/discovery.(*srvResolver).lookupSRV()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver.go:186 +0xb8f
  github.com/mailgun/holster/v4/discovery.(*srvResolver).watcher()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver.go:117 +0x1b7
  github.com/mailgun/holster/v4/discovery.(*srvResolverBuilder).Build.func1()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver.go:62 +0x39

Goroutine 43 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1493 +0x75d
  testing.runTests.func1()
      /usr/local/go/src/testing/testing.go:1846 +0x99
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1446 +0x216
  testing.runTests()
      /usr/local/go/src/testing/testing.go:1844 +0x7ec
  testing.(*M).Run()
      /usr/local/go/src/testing/testing.go:1726 +0xa84
  main.main()
      _testmain.go:63 +0x2e9

Goroutine 46 (running) created at:
  github.com/mailgun/holster/v4/discovery.(*srvResolverBuilder).Build()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver.go:62 +0x336
  github.com/mailgun/holster/v4/discovery_test.TestSrvResolverBuilderSuccess()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver_test.go:67 +0x836
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1446 +0x216
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1493 +0x47
==================
==================
WARNING: DATA RACE
Read at 0x00c0000ae4c8 by goroutine 43:
  github.com/mailgun/holster/v4/discovery_test.TestSrvResolverBuilderSuccess()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver_test.go:83 +0xaa4
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1446 +0x216
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1493 +0x47

Previous write at 0x00c0000ae4c8 by goroutine 46:
  runtime.slicecopy()
      /usr/local/go/src/runtime/slice.go:307 +0x0
  github.com/mailgun/holster/v4/discovery.(*srvResolver).lookupSRV()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver.go:186 +0xb8f
  github.com/mailgun/holster/v4/discovery.(*srvResolver).watcher()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver.go:117 +0x1b7
  github.com/mailgun/holster/v4/discovery.(*srvResolverBuilder).Build.func1()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver.go:62 +0x39

Goroutine 43 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1493 +0x75d
  testing.runTests.func1()
      /usr/local/go/src/testing/testing.go:1846 +0x99
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1446 +0x216
  testing.runTests()
      /usr/local/go/src/testing/testing.go:1844 +0x7ec
  testing.(*M).Run()
      /usr/local/go/src/testing/testing.go:1726 +0xa84
  main.main()
      _testmain.go:63 +0x2e9

Goroutine 46 (running) created at:
  github.com/mailgun/holster/v4/discovery.(*srvResolverBuilder).Build()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver.go:62 +0x336
  github.com/mailgun/holster/v4/discovery_test.TestSrvResolverBuilderSuccess()
      /Users/vtopc/mailgun/holster/discovery/grpc_srv_resolver_test.go:67 +0x836
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1446 +0x216
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1493 +0x47
==================
    testing.go:1319: race detected during execution of test
--- FAIL: TestSrvResolverBuilderSuccess (0.00s)