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 happens when bootstrap #44776

Closed
Tracked by #41316
xuyifangreeneyes opened this issue Jun 19, 2023 · 0 comments · Fixed by #44789
Closed
Tracked by #41316

Data race happens when bootstrap #44776

xuyifangreeneyes opened this issue Jun 19, 2023 · 0 comments · Fixed by #44789
Assignees
Labels
affects-7.2 severity/minor type/bug The issue is confirmed as a bug.

Comments

@xuyifangreeneyes
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Start a tidb cluster.

2. What did you expect to see? (Required)

==================
WARNING: DATA RACE
Read at 0x00000c2b2810 by goroutine 14443:
  github.com/tikv/client-go/v2/internal/client.buildResourceControlInterceptor()
      /go/pkg/mod/github.com/tikv/client-go/[email protected]/internal/client/client_interceptor.go:99 +0xd1
  github.com/tikv/client-go/v2/internal/client.interceptedClient.SendRequest()
      /go/pkg/mod/github.com/tikv/client-go/[email protected]/internal/client/client_interceptor.go:49 +0xca
  github.com/tikv/client-go/v2/internal/client.(*interceptedClient).SendRequest()
      <autogenerated>:1 +0xbd
  github.com/tikv/client-go/v2/internal/client.reqCollapse.SendRequest()
      /go/pkg/mod/github.com/tikv/client-go/[email protected]/internal/client/client_collapse.go:74 +0x130
  github.com/tikv/client-go/v2/internal/client.(*reqCollapse).SendRequest()
      <autogenerated>:1 +0xae
  github.com/tikv/client-go/v2/internal/locate.(*RegionRequestSender).sendReqToRegion()
      /go/pkg/mod/github.com/tikv/client-go/[email protected]/internal/locate/region_request.go:1412 +0x1238
  github.com/tikv/client-go/v2/internal/locate.(*RegionRequestSender).SendReqCtx()
      /go/pkg/mod/github.com/tikv/client-go/[email protected]/internal/locate/region_request.go:1220 +0x1f89
  github.com/tikv/client-go/v2/txnkv/txnsnapshot.(*ClientHelper).SendReqCtx()
      /go/pkg/mod/github.com/tikv/client-go/[email protected]/txnkv/txnsnapshot/client_helper.go:146 +0x373
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/store/copr/coprocessor.go:1205 +0x14cc
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/store/copr/coprocessor.go:1110 +0x1e5
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).run()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/store/copr/coprocessor.go:803 +0x176
  github.com/pingcap/tidb/store/copr.(*copIterator).open.func2()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/store/copr/coprocessor.go:847 +0x58

Previous write at 0x00000c2b2810 by main goroutine:
  github.com/tikv/client-go/v2/tikv.SetResourceControlInterceptor()
      /go/pkg/mod/github.com/tikv/client-go/[email protected]/tikv/kv.go:708 +0x6f8
  main.main()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/tidb-server/main.go:241 +0x6d8
  github.com/pingcap/tidb/sessionctx/variable.(*SysVar).ValidateWithRelaxedValidation()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/sessionctx/variable/variable.go:361 +0x1c7
  github.com/pingcap/tidb/domain.(*Domain).rebuildSysVarCache()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/domain/sysvar_cache.go:146 +0x844
  github.com/pingcap/tidb/domain.(*Domain).LoadSysVarCacheLoop()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/domain/domain.go:1774 +0xa8
  github.com/pingcap/tidb/session.bootstrapSessionImpl()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/session/session.go:3357 +0x6e4
  github.com/pingcap/tidb/domain.(*Domain).GetSessionCache()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/domain/sysvar_cache.go:62 +0x5c
  github.com/pingcap/tidb/session.(*session).loadCommonGlobalVariablesIfNeeded()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/session/session.go:3721 +0x104
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/session/session.go:2130 +0x145
  github.com/pingcap/tidb/session.(*session).ExecuteInternal()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/session/session.go:1666 +0x31b
  github.com/pingcap/tidb/domain.(*Domain).LoadPrivilegeLoop()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/domain/domain.go:1717 +0x130
  github.com/pingcap/tidb/session.bootstrapSessionImpl()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/session/session.go:3350 +0x687
  github.com/pingcap/tidb/session.BootstrapSession()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/session/session.go:3271 +0x233
  main.createStoreAndDomain()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/tidb-server/main.go:340 +0x21d
  main.main()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/tidb-server/main.go:239 +0x698

Goroutine 14443 (running) created at:
  github.com/pingcap/tidb/store/copr.(*copIterator).open()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/store/copr/coprocessor.go:847 +0x104
  github.com/pingcap/tidb/store/copr.(*CopClient).Send()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/store/copr/coprocessor.go:101 +0x3ac
  github.com/pingcap/tidb/distsql.Select()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/distsql/distsql.go:91 +0x826
  github.com/pingcap/tidb/distsql.SelectWithRuntimeStats()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/distsql/distsql.go:146 +0xbb
  github.com/pingcap/tidb/executor.selectResultHook.SelectResult()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/table_reader.go:61 +0x1c5
  github.com/pingcap/tidb/executor.(*TableReaderExecutor).buildResp()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/table_reader.go:349 +0x9a4
  github.com/pingcap/tidb/executor.(*TableReaderExecutor).Open()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/table_reader.go:226 +0xd91
  github.com/pingcap/tidb/executor.(*ExecStmt).openExecutor()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/adapter.go:1211 +0xe9
  github.com/pingcap/tidb/executor.(*ExecStmt).Exec()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/adapter.go:539 +0xb94
  github.com/pingcap/tidb/session.runStmt()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/session/session.go:2400 +0x4f8
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/session/session.go:2250 +0x133c
  github.com/pingcap/tidb/session.(*session).ExecuteInternal()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/session/session.go:1666 +0x31b
  github.com/pingcap/tidb/statistics/handle.(*Handle).initStatsMeta()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/statistics/handle/bootstrap.go:68 +0x13e
  github.com/pingcap/tidb/statistics/handle.(*Handle).InitStatsLite()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/statistics/handle/bootstrap.go:473 +0x1e5
  github.com/pingcap/tidb/domain.(*Domain).initStats()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/domain/domain.go:2390 +0x14d
  github.com/pingcap/tidb/domain.(*Domain).loadStatsWorker()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/domain/domain.go:2414 +0x135
  github.com/pingcap/tidb/domain.(*Domain).loadStatsWorker-fm()
      <autogenerated>:1 +0x39
  github.com/pingcap/tidb/util.(*WaitGroupEnhancedWrapper).Run.func1()
      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/util/wait_group_wrapper.go:96 +0xb7
==================

3. What did you see instead (Required)

No data race.

4. What is your TiDB version? (Required)

master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.2 severity/minor type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants