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 at the GlobalStmtSummary #42128

Closed
Tracked by #41316
hawkingrei opened this issue Mar 13, 2023 · 0 comments · Fixed by #42133
Closed
Tracked by #41316

DATA RACE at the GlobalStmtSummary #42128

hawkingrei opened this issue Mar 13, 2023 · 0 comments · Fixed by #42133
Labels
component/test severity/moderate type/bug The issue is confirmed as a bug.

Comments

@hawkingrei
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

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

3. What did you see instead (Required)

==================
 WARNING: DATA RACE
Write at 0x00000b688670 by goroutine 152:
  github.com/pingcap/tidb/domain_test.closeStmtSummary()
      domain/extract_test.go:96 +0x54
  runtime.deferreturn()
      GOROOT/src/runtime/panic.go:476 +0x32
  github.com/pingcap/tidb/domain.(*extractWorker).extractPlanTask()
      domain/extract.go:155 +0x49a
  github.com/pingcap/tidb/domain.(*extractWorker).extractTask()
      domain/extract.go:136 +0x126
  github.com/pingcap/tidb/domain.(*ExtractHandle).ExtractTask()
      domain/extract.go:93 +0x40c
  github.com/pingcap/tidb/domain_test.TestExtractHandlePlanTask()
      domain/extract_test.go:77 +0x3d5
  github.com/pingcap/tidb/session.runStmt()
      session/session.go:2333 +0x62f
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      session/session.go:2190 +0x10dd
  github.com/pingcap/tidb/testkit.(*TestKit).ExecWithContext()
      testkit/testkit.go:323 +0x8ae
  github.com/pingcap/tidb/testkit.(*TestKit).MustExecWithContext()
      testkit/testkit.go:132 +0xb7
  github.com/pingcap/tidb/testkit.(*TestKit).MustExec()
      testkit/testkit.go:127 +0xf7
  github.com/pingcap/tidb/domain_test.TestExtractHandlePlanTask()
      domain/extract_test.go:62 +0x135
  github.com/pingcap/tidb/session.runStmt()
      session/session.go:2333 +0x62f
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      session/session.go:2190 +0x10dd
  github.com/pingcap/tidb/testkit.(*TestKit).ExecWithContext()
      testkit/testkit.go:323 +0x8ae
  github.com/pingcap/tidb/testkit.(*TestKit).MustExecWithContext()
      testkit/testkit.go:132 +0xb7
  github.com/pingcap/tidb/testkit.(*TestKit).MustExec()
      testkit/testkit.go:127 +0xf7
  github.com/pingcap/tidb/domain_test.TestExtractHandlePlanTask()
      domain/extract_test.go:61 +0x115
  github.com/pingcap/tidb/domain.(*Domain).rebuildSysVarCache()
      domain/sysvar_cache.go:146 +0x8c4
  github.com/pingcap/tidb/domain.(*Domain).LoadSysVarCacheLoop()
      domain/domain.go:1470 +0xa8
  github.com/pingcap/tidb/session.BootstrapSession()
      session/session.go:3314 +0x6d3
  github.com/pingcap/tidb/domain.(*Domain).GetSessionCache()
      domain/sysvar_cache.go:62 +0x5c
  github.com/pingcap/tidb/session.(*session).loadCommonGlobalVariablesIfNeeded()
      session/session.go:3656 +0x104
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      session/session.go:2093 +0x145
  github.com/pingcap/tidb/session.(*session).ExecuteInternal()
      session/session.go:1628 +0x31b
  github.com/pingcap/tidb/domain.(*Domain).LoadPrivilegeLoop()
      domain/domain.go:1414 +0x130
  github.com/pingcap/tidb/session.BootstrapSession()
      session/session.go:3307 +0x684
  github.com/pingcap/tidb/testkit.bootstrap()
      testkit/mockstore.go:85 +0xac
  github.com/pingcap/tidb/testkit.CreateMockStoreAndDomain()
      testkit/mockstore.go:70 +0xe9
  github.com/pingcap/tidb/domain_test.TestExtractHandlePlanTask()
      domain/extract_test.go:56 +0x84
  testing.tRunner()
      GOROOT/src/testing/testing.go:1576 +0x216
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1629 +0x47
Previous read at 0x00000b688670 by goroutine 24055:
  github.com/pingcap/tidb/util/stmtsummary/v2.Enabled()
      util/stmtsummary/v2/stmtsummary.go:544 +0x75
  github.com/pingcap/tidb/executor.(*ExecStmt).SummaryStmt()
      executor/adapter.go:1755 +0x10b
  github.com/pingcap/tidb/executor.(*ExecStmt).FinishExecuteStmt()
      executor/adapter.go:1359 +0x624
  github.com/pingcap/tidb/executor.(*ExecStmt).CloseRecordSet()
      executor/adapter.go:1432 +0x50
  github.com/pingcap/tidb/executor.(*recordSet).Close()
      executor/adapter.go:179 +0xbd
  github.com/pingcap/tidb/session.(*execStmtResult).Close()
      session/session.go:2388 +0x6f
  github.com/pingcap/tidb/util/sqlexec.RecordSet.Close-fm()
      <autogenerated>:1 +0x48
  github.com/pingcap/tidb/parser/terror.Call()
      parser/terror/terror.go:306 +0x4a
  github.com/pingcap/tidb/ddl.(*session).execute.func2()
      ddl/ddl.go:1648 +0x39
  runtime.deferreturn()
      GOROOT/src/runtime/panic.go:476 +0x32
  github.com/pingcap/tidb/ddl.(*ddl).getJob()
      ddl/job_table.go:113 +0x1c4
  github.com/pingcap/tidb/ddl.(*ddl).getReorgJob()
      ddl/job_table.go:163 +0x69
  github.com/pingcap/tidb/ddl.(*ddl).getReorgJob-fm()
      <autogenerated>:1 +0x44
  github.com/pingcap/tidb/ddl.(*ddl).loadDDLJobAndRun()
      ddl/job_table.go:225 +0x41d
  github.com/pingcap/tidb/ddl.(*ddl).startDispatchLoop()
      ddl/job_table.go:210 +0xb31
  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 +0x73
Goroutine 152 (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
  go.uber.org/goleak.VerifyTestMain()
      external/org_uber_go_goleak/testmain.go:53 +0x70
  github.com/pingcap/tidb/domain_test.TestMain()
      domain/main_test.go:35 +0x54f
  main.main()
      bazel-out/k8-fastbuild/bin/domain/domain_test_/testmain.go:144 +0x5e8
Goroutine 24055 (running) created at:
  github.com/pingcap/tidb/util.(*WaitGroupWrapper).Run()
      util/wait_group_wrapper.go:152 +0xe4
  github.com/pingcap/tidb/ddl.(*ddl).prepareWorkers4ConcurrencyDDL()
      ddl/ddl.go:740 +0x4a9
  github.com/pingcap/tidb/ddl.(*ddl).Start()
      ddl/ddl.go:777 +0x629
  github.com/pingcap/tidb/domain.(*Domain).Init()
      domain/domain.go:1131 +0x145c
  github.com/pingcap/tidb/session.(*domainMap).Get.func1()
      session/tidb.go:92 +0x676
  github.com/pingcap/tidb/util.RunWithRetry()
      util/misc.go:69 +0x93
  github.com/pingcap/tidb/session.(*domainMap).Get()
      session/tidb.go:78 +0x2d2
  github.com/pingcap/tidb/session.createSessionWithOpt()
      session/session.go:3513 +0x75
  github.com/pingcap/tidb/session.createSession()
      session/session.go:3509 +0x84
  github.com/pingcap/tidb/session.createSessions()
      session/session.go:3494 +0x6e
  github.com/pingcap/tidb/session.BootstrapSession()
      session/session.go:3274 +0x3db
  github.com/pingcap/tidb/testkit.bootstrap()
      testkit/mockstore.go:85 +0xac
  github.com/pingcap/tidb/testkit.CreateMockStoreAndDomain()
      testkit/mockstore.go:70 +0xe9
  github.com/pingcap/tidb/domain_test.TestExtractHandlePlanTask()
      domain/extract_test.go:56 +0x84
  testing.tRunner()
      GOROOT/src/testing/testing.go:1576 +0x216
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1629 +0x47 
================== 

4. What is your TiDB version? (Required)

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

Successfully merging a pull request may close this issue.

2 participants