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

DATARACE at github.com/tikv/client-go/v2/tikv.SetResourceControlInterceptor() #44800

Closed
xhebox opened this issue Jun 19, 2023 · 1 comment · Fixed by #44853
Closed

DATARACE at github.com/tikv/client-go/v2/tikv.SetResourceControlInterceptor() #44800

xhebox opened this issue Jun 19, 2023 · 1 comment · Fixed by #44853
Labels

Comments

@xhebox
Copy link
Contributor

xhebox commented Jun 19, 2023

Bug Report

==================

WARNING: DATA RACE

Write at 0x00000bebbec0 by goroutine 119:

  github.com/tikv/client-go/v2/tikv.SetResourceControlInterceptor()

      external/com_github_tikv_client_go_v2/tikv/kv.go:708 +0x35e

  github.com/pingcap/tidb/domain.(*Domain).initResourceGroupsController()

      domain/domain.go:1385 +0x352

  github.com/pingcap/tidb/domain.(*Domain).Init()

      domain/domain.go:1190 +0x1131

  github.com/pingcap/tidb/session.(*domainMap).Get.func1()

      session/tidb.go:93 +0x67c

  github.com/pingcap/tidb/util.RunWithRetry()

      util/misc.go:69 +0xbe

  github.com/pingcap/tidb/session.(*domainMap).Get()

      session/tidb.go:79 +0x2f8

  github.com/pingcap/tidb/session.createSessionWithOpt()

      session/session.go:3578 +0x86

  github.com/pingcap/tidb/session.createSession4DistExecution()

      session/session.go:3574 +0x49

  github.com/pingcap/tidb/session.createSessionsImpl()

      session/session.go:3555 +0xa1

  github.com/pingcap/tidb/session.createSessions4DistExecution()

      session/session.go:3548 +0x84

  github.com/pingcap/tidb/session.bootstrapSessionImpl()

      session/session.go:3317 +0x45d

  github.com/pingcap/tidb/session.BootstrapSession4DistExecution()

      session/session.go:3276 +0x4e

  github.com/pingcap/tidb/testkit.bootstrap4DistExecution()

      testkit/mockstore.go:206 +0x73

  github.com/pingcap/tidb/testkit.NewDistExecutionTestContext()

      testkit/mockstore.go:177 +0x254

  github.com/pingcap/tidb/domain.(*Domain).rebuildSysVarCache()

      domain/sysvar_cache.go:146 +0x7c4

  github.com/pingcap/tidb/domain.(*Domain).LoadSysVarCacheLoop()

      domain/domain.go:1775 +0xb9

  github.com/pingcap/tidb/session.bootstrapSessionImpl()

      session/session.go:3357 +0x7cc

  github.com/pingcap/tidb/domain.(*Domain).GetSessionCache()

      domain/sysvar_cache.go:62 +0x71

  github.com/pingcap/tidb/session.(*session).loadCommonGlobalVariablesIfNeeded()

      session/session.go:3721 +0x11e

  github.com/pingcap/tidb/session.(*session).ExecuteStmt()

      session/session.go:2130 +0x16b

  github.com/pingcap/tidb/session.(*session).ExecuteInternal()

      session/session.go:1666 +0x365

  github.com/pingcap/tidb/domain.(*Domain).LoadPrivilegeLoop()

      domain/domain.go:1718 +0x143

  github.com/pingcap/tidb/session.bootstrapSessionImpl()

      session/session.go:3350 +0x76c

  github.com/pingcap/tidb/session.BootstrapSession4DistExecution()

      session/session.go:3276 +0x4e

  github.com/pingcap/tidb/testkit.bootstrap4DistExecution()

      testkit/mockstore.go:206 +0x73

  github.com/pingcap/tidb/testkit.NewDistExecutionTestContext()

      testkit/mockstore.go:177 +0x254

  disttask/framework/framework_test_test.TestFrameworkBasic()

      disttask/framework/framework_test.go:186 +0xc4

  testing.tRunner()

      GOROOT/src/testing/testing.go:1576 +0x216

  testing.(*T).Run.func1()

      GOROOT/src/testing/testing.go:1629 +0x47


Previous read at 0x00000bebbec0 by goroutine 49079:

  github.com/tikv/client-go/v2/internal/client.buildResourceControlInterceptor.func1.1()

      external/com_github_tikv_client_go_v2/internal/client/client_interceptor.go:116 +0x1be

  github.com/tikv/client-go/v2/internal/client.interceptedClient.SendRequest()

      external/com_github_tikv_client_go_v2/internal/client/client_interceptor.go:61 +0x29b

  github.com/tikv/client-go/v2/internal/client.(*interceptedClient).SendRequest()

      <autogenerated>:1 +0xbd

  github.com/tikv/client-go/v2/internal/client.reqCollapse.SendRequest()

      external/com_github_tikv_client_go_v2/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()

      external/com_github_tikv_client_go_v2/internal/locate/region_request.go:1412 +0x1238

  github.com/tikv/client-go/v2/internal/locate.(*RegionRequestSender).SendReqCtx()

      external/com_github_tikv_client_go_v2/internal/locate/region_request.go:1220 +0x1f89

  github.com/tikv/client-go/v2/txnkv/txnsnapshot.(*ClientHelper).SendReqCtx()

      external/com_github_tikv_client_go_v2/txnkv/txnsnapshot/client_helper.go:146 +0x373

  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce()

      store/copr/coprocessor.go:1205 +0x1779

  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask()

      store/copr/coprocessor.go:1110 +0x224

  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).run()

      store/copr/coprocessor.go:803 +0x1e4

  github.com/pingcap/tidb/store/copr.(*copIterator).open.func1()

      store/copr/coprocessor.go:847 +0x58


Goroutine 119 (running) created at:

  testing.(*T).Run()

      GOROOT/src/testing/testing.go:1629 +0x805

  testing.runTests.func1()

      GOROOT/src/testing/testing.go:2036 +0x8d

  testing.tRunner()

      GOROOT/src/testing/testing.go:1576 +0x216

  testing.runTests()

      GOROOT/src/testing/testing.go:2034 +0x87c

  testing.(*M).Run()

      GOROOT/src/testing/testing.go:1906 +0xb44

  main.main()

      bazel-out/k8-fastbuild/bin/disttask/framework/framework_test_/testmain.go:126 +0x7b4


Goroutine 49079 (finished) created at:

  github.com/pingcap/tidb/store/copr.(*copIterator).open()

      store/copr/coprocessor.go:847 +0x11d

  github.com/pingcap/tidb/store/copr.(*CopClient).Send()

      store/copr/coprocessor.go:101 +0x36e

  github.com/pingcap/tidb/distsql.Select()

      distsql/distsql.go:91 +0x88d

  github.com/pingcap/tidb/distsql.SelectWithRuntimeStats()

      distsql/distsql.go:146 +0xcc

  github.com/pingcap/tidb/executor.selectResultHook.SelectResult()

      executor/table_reader.go:61 +0x204

  github.com/pingcap/tidb/executor.(*TableReaderExecutor).buildResp()

      executor/table_reader.go:349 +0x926

  github.com/pingcap/tidb/executor.(*TableReaderExecutor).Open()

      executor/table_reader.go:226 +0x12b3

  github.com/pingcap/tidb/executor.(*baseExecutor).Open()

      executor/executor.go:204 +0xf5

  github.com/pingcap/tidb/executor.(*HashAggExec).Open()

      executor/aggregate.go:303 +0x233

  github.com/pingcap/tidb/executor.(*baseExecutor).Open()

      executor/executor.go:204 +0xf5

  github.com/pingcap/tidb/executor.(*SelectionExec).Open()

      executor/executor.go:1646 +0x7a

  github.com/pingcap/tidb/executor.(*baseExecutor).Open()

      executor/executor.go:204 +0xf5

  github.com/pingcap/tidb/executor.(*HashAggExec).Open()

      executor/aggregate.go:303 +0x233

  github.com/pingcap/tidb/executor.(*baseExecutor).Open()

      executor/executor.go:204 +0xf5

  github.com/pingcap/tidb/executor.(*HashJoinExec).Open()

      executor/join.go:201 +0x7a

  github.com/pingcap/tidb/executor.(*SortExec).Open()

      executor/sort.go:100 +0x343

  github.com/pingcap/tidb/executor.(*baseExecutor).Open()

      executor/executor.go:204 +0xf5

  github.com/pingcap/tidb/executor.(*ProjectionExec).Open()

      executor/projection.go:86 +0x7a

  github.com/pingcap/tidb/executor.(*ExecStmt).openExecutor()

      executor/adapter.go:1211 +0x109

  github.com/pingcap/tidb/executor.(*ExecStmt).Exec()

      executor/adapter.go:539 +0xeb4

  github.com/pingcap/tidb/session.runStmt()

      session/session.go:2400 +0x701

  github.com/pingcap/tidb/session.(*session).ExecuteStmt()

      session/session.go:2250 +0x1767

  github.com/pingcap/tidb/session.(*session).ExecuteInternal()

      session/session.go:1666 +0x365

  github.com/pingcap/tidb/ddl/internal/session.(*Session).Execute()

      ddl/internal/session/session.go:85 +0x26d

  github.com/pingcap/tidb/ddl.(*ddl).getJob()

      ddl/job_table.go:116 +0x1fc

  github.com/pingcap/tidb/ddl.(*ddl).getGeneralJob()

      ddl/job_table.go:226 +0x77

  github.com/pingcap/tidb/ddl.(*ddl).getGeneralJob-fm()

      <autogenerated>:1 +0x44

  github.com/pingcap/tidb/ddl.(*ddl).loadDDLJobAndRun()

      ddl/job_table.go:360 +0x3e4

  github.com/pingcap/tidb/ddl.(*ddl).startDispatchLoop()

      ddl/job_table.go:301 +0xb25

  github.com/pingcap/tidb/ddl.(*ddl).startDispatchLoop-fm()

      <autogenerated>:1 +0x39

  github.com/pingcap/tidb/util.(*WaitGroupWrapper).Run.func1()

      util/wait_group_wrapper.go:154 +0x87

==================

https://do.pingcap.net/jenkins/blue/organizations/jenkins/pingcap%2Ftidb%2Fghpr_unit_test/detail/ghpr_unit_test/26898/pipeline

1. Minimal reproduce step (Required)

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

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

@xhebox xhebox added the type/bug The issue is confirmed as a bug. label Jun 19, 2023
@ti-chi-bot ti-chi-bot bot added may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels Jun 20, 2023
@seiya-annie seiya-annie removed may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants