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

DATA RACE in region_cache.go #1544

Closed
asddongmen opened this issue Jan 7, 2025 · 1 comment · Fixed by #1545
Closed

DATA RACE in region_cache.go #1544

asddongmen opened this issue Jan 7, 2025 · 1 comment · Fixed by #1545

Comments

@asddongmen
Copy link

=== Command to ticdc(new arch).
==================
WARNING: DATA RACE
Read at 0x00c006544210 by goroutine 632:
  github.com/tikv/client-go/v2/internal/locate.(*RegionCache).reportStoreReplicaFlows-fm.(*RegionCache).reportStoreReplicaFlows.func1()
      /home/dongmen/tigate/vendor/github.com/tikv/client-go/v2/internal/locate/region_cache.go:3056 +0xa6
  github.com/tikv/client-go/v2/internal/locate.(*storeCacheImpl).forEach()
      /home/dongmen/tigate/vendor/github.com/tikv/client-go/v2/internal/locate/store_cache.go:158 +0x18b
  github.com/tikv/client-go/v2/internal/locate.(*RegionCache).reportStoreReplicaFlows()
      /home/dongmen/tigate/vendor/github.com/tikv/client-go/v2/internal/locate/region_cache.go:3054 +0x56
  github.com/tikv/client-go/v2/internal/locate.(*RegionCache).reportStoreReplicaFlows-fm()
      <autogenerated>:1 +0x17
  github.com/tikv/client-go/v2/internal/locate.NewRegionCache.repeat.func4()
      /home/dongmen/tigate/vendor/github.com/tikv/client-go/v2/internal/locate/region_cache.go:503 +0x2e
  github.com/tikv/client-go/v2/internal/locate.(*bgRunner).schedule.func1()
      /home/dongmen/tigate/vendor/github.com/tikv/client-go/v2/internal/locate/region_cache.go:574 +0x259

Previous write at 0x00c006544210 by goroutine 634:
  github.com/tikv/client-go/v2/internal/locate.refreshFullStoreList()
      /home/dongmen/tigate/vendor/github.com/tikv/client-go/v2/internal/locate/region_cache.go:761 +0x364
  github.com/tikv/client-go/v2/internal/locate.NewRegionCache.func3()
      /home/dongmen/tigate/vendor/github.com/tikv/client-go/v2/internal/locate/region_cache.go:731 +0x5c
  github.com/tikv/client-go/v2/internal/locate.(*bgRunner).schedule.func1()
      /home/dongmen/tigate/vendor/github.com/tikv/client-go/v2/internal/locate/region_cache.go:574 +0x259

Goroutine 632 (running) created at:
  github.com/tikv/client-go/v2/internal/locate.(*bgRunner).schedule()
      /home/dongmen/tigate/vendor/github.com/tikv/client-go/v2/internal/locate/region_cache.go:563 +0x147
  github.com/tikv/client-go/v2/internal/locate.NewRegionCache()
      /home/dongmen/tigate/vendor/github.com/tikv/client-go/v2/internal/locate/region_cache.go:717 +0x115d
  github.com/tikv/client-go/v2/tikv.NewKVStore()
      /home/dongmen/tigate/vendor/github.com/tikv/client-go/v2/tikv/kv.go:267 +0x1e4
  github.com/pingcap/tidb/pkg/store/driver.TiKVDriver.OpenWithOptions()
      /home/dongmen/tigate/vendor/github.com/pingcap/tidb/pkg/store/driver/tikv_driver.go:218 +0x1154
  github.com/pingcap/tiflow/cdc/kv.CreateTiStore()
      /home/dongmen/tigate/vendor/github.com/pingcap/tiflow/cdc/kv/utils.go:54 +0x3d7
  github.com/pingcap/ticdc/server.(*server).prepare()
      /home/dongmen/tigate/server/server_prepare.go:115 +0xe44
  github.com/pingcap/ticdc/server.(*server).initialize()
      /home/dongmen/tigate/server/server.go:115 +0xb5
  github.com/pingcap/ticdc/server.(*server).Run()
      /home/dongmen/tigate/server/server.go:171 +0x11b
  github.com/pingcap/ticdc/cmd/server.(*options).run()
      /home/dongmen/tigate/cmd/server/server.go:117 +0xec5
  github.com/pingcap/ticdc/cmd/server.NewCmdServer.func1()
      /home/dongmen/tigate/cmd/server/server.go:232 +0x93
  github.com/spf13/cobra.(*Command).execute()
      /home/dongmen/tigate/vendor/github.com/spf13/cobra/command.go:985 +0x10f3
  github.com/spf13/cobra.(*Command).ExecuteC()
      /home/dongmen/tigate/vendor/github.com/spf13/cobra/command.go:1117 +0x655
  github.com/spf13/cobra.(*Command).Execute()
      /home/dongmen/tigate/vendor/github.com/spf13/cobra/command.go:1041 +0x55a
  github.com/pingcap/ticdc/cmd.main()
      /home/dongmen/tigate/cmd/main.go:133 +0x560
  github.com/pingcap/ticdc/cmd.TestRunMain()
      /home/dongmen/tigate/cmd/main_test.go:35 +0x1e4
  testing.tRunner()
      /root/go/pkg/mod/golang.org/[email protected]/src/testing/testing.go:1690 +0x226
  testing.(*T).Run.gowrap1()
      /root/go/pkg/mod/golang.org/[email protected]/src/testing/testing.go:1743 +0x44

Goroutine 634 (running) created at:
  github.com/tikv/client-go/v2/internal/locate.(*bgRunner).schedule()
      /home/dongmen/tigate/vendor/github.com/tikv/client-go/v2/internal/locate/region_cache.go:563 +0x147
  github.com/tikv/client-go/v2/internal/locate.NewRegionCache()
      /home/dongmen/tigate/vendor/github.com/tikv/client-go/v2/internal/locate/region_cache.go:729 +0x16f6
  github.com/tikv/client-go/v2/tikv.NewKVStore()
      /home/dongmen/tigate/vendor/github.com/tikv/client-go/v2/tikv/kv.go:267 +0x1e4
  github.com/pingcap/tidb/pkg/store/driver.TiKVDriver.OpenWithOptions()
      /home/dongmen/tigate/vendor/github.com/pingcap/tidb/pkg/store/driver/tikv_driver.go:218 +0x1154
  github.com/pingcap/tiflow/cdc/kv.CreateTiStore()
      /home/dongmen/tigate/vendor/github.com/pingcap/tiflow/cdc/kv/utils.go:54 +0x3d7
  github.com/pingcap/ticdc/server.(*server).prepare()
      /home/dongmen/tigate/server/server_prepare.go:115 +0xe44
  github.com/pingcap/ticdc/server.(*server).initialize()
      /home/dongmen/tigate/server/server.go:115 +0xb5
  github.com/pingcap/ticdc/server.(*server).Run()
      /home/dongmen/tigate/server/server.go:171 +0x11b
  github.com/pingcap/ticdc/cmd/server.(*options).run()
      /home/dongmen/tigate/cmd/server/server.go:117 +0xec5
  github.com/pingcap/ticdc/cmd/server.NewCmdServer.func1()
      /home/dongmen/tigate/cmd/server/server.go:232 +0x93
  github.com/spf13/cobra.(*Command).execute()
      /home/dongmen/tigate/vendor/github.com/spf13/cobra/command.go:985 +0x10f3
  github.com/spf13/cobra.(*Command).ExecuteC()
      /home/dongmen/tigate/vendor/github.com/spf13/cobra/command.go:1117 +0x655
  github.com/spf13/cobra.(*Command).Execute()
      /home/dongmen/tigate/vendor/github.com/spf13/cobra/command.go:1041 +0x55a
  github.com/pingcap/ticdc/cmd.main()
      /home/dongmen/tigate/cmd/main.go:133 +0x560
  github.com/pingcap/ticdc/cmd.TestRunMain()
      /home/dongmen/tigate/cmd/main_test.go:35 +0x1e4
  testing.tRunner()
      /root/go/pkg/mod/golang.org/[email protected]/src/testing/testing.go:1690 +0x226
  testing.(*T).Run.gowrap1()
      /root/go/pkg/mod/golang.org/[email protected]/src/testing/testing.go:1743 +0x44
==================
@asddongmen
Copy link
Author

Version: github.com/tikv/client-go/v2 v2.0.8-0.20241008085809-c3e10ae7c8fc

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 a pull request may close this issue.

1 participant