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 infoschema TestSlowQueryOOM #33982

Closed
Tracked by #33745
tiancaiamao opened this issue Apr 14, 2022 · 2 comments · Fixed by #34016
Closed
Tracked by #33745

data race in infoschema TestSlowQueryOOM #33982

tiancaiamao opened this issue Apr 14, 2022 · 2 comments · Fixed by #34016
Labels
component/test severity/minor type/bug The issue is confirmed as a bug.

Comments

@tiancaiamao
Copy link
Contributor

No description provided.

@tiancaiamao
Copy link
Contributor Author

WARNING: DATA RACE
Write at 0x00c00474d0a8 by goroutine 89:
  github.com/pingcap/tidb/sessionctx/variable.(*SessionVars).InitStatementContext()
      /home/genius/project/src/github.com/pingcap/tidb/sessionctx/variable/session.go:1034 +0x1e4
  github.com/pingcap/tidb/executor.ResetContextOfStmt()
      /home/genius/project/src/github.com/pingcap/tidb/executor/executor.go:1755 +0x12f
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      /home/genius/project/src/github.com/pingcap/tidb/session/session.go:1825 +0x384
  github.com/pingcap/tidb/testkit.(*TestKit).Exec()
      /home/genius/project/src/github.com/pingcap/tidb/testkit/testkit.go:209 +0x6bc
  github.com/pingcap/tidb/testkit.(*TestKit).MustExec()
      /home/genius/project/src/github.com/pingcap/tidb/testkit/testkit.go:88 +0x99
  github.com/pingcap/tidb/infoschema_test.TestSlowQueryOOM.func2()
      /home/genius/project/src/github.com/pingcap/tidb/infoschema/cluster_tables_test.go:686 +0x166
  github.com/pingcap/tidb/infoschema_test.TestSlowQueryOOM()
      /home/genius/project/src/github.com/pingcap/tidb/infoschema/cluster_tables_test.go:701 +0x9fa
  testing.tRunner()
      /home/genius/project/go/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /home/genius/project/go/src/testing/testing.go:1486 +0x47

Previous read at 0x00c00474d0a8 by goroutine 47:
  github.com/pingcap/tidb/util/memory.(*Tracker).Consume.func1()
      /home/genius/project/src/github.com/pingcap/tidb/util/memory/tracker.go:335 +0x91
  github.com/pingcap/tidb/util/memory.(*Tracker).Consume()
      /home/genius/project/src/github.com/pingcap/tidb/util/memory/tracker.go:344 +0x192
  github.com/pingcap/tidb/executor.(*slowQueryRetriever).memConsume()
      /home/genius/project/src/github.com/pingcap/tidb/executor/slow_query.go:1123 +0x227
  github.com/pingcap/tidb/executor.(*slowQueryRetriever).parseLog()
      /home/genius/project/src/github.com/pingcap/tidb/executor/slow_query.go:558 +0x1e0
  github.com/pingcap/tidb/executor.(*slowQueryRetriever).parseSlowLog.func1()
      /home/genius/project/src/github.com/pingcap/tidb/executor/slow_query.go:478 +0x104
  github.com/pingcap/tidb/util.(*WaitGroupWrapper).Run.func1()
      /home/genius/project/src/github.com/pingcap/tidb/util/wait_group_wrapper.go:33 +0x73

Goroutine 89 (running) created at:
  testing.(*T).Run()
      /home/genius/project/go/src/testing/testing.go:1486 +0x724
  testing.runTests.func1()
      /home/genius/project/go/src/testing/testing.go:1839 +0x99
  testing.tRunner()
      /home/genius/project/go/src/testing/testing.go:1439 +0x213
  testing.runTests()
      /home/genius/project/go/src/testing/testing.go:1837 +0x7e4
  testing.(*M).Run()
      /home/genius/project/go/src/testing/testing.go:1719 +0xa71
  go.uber.org/goleak.VerifyTestMain()
      /home/genius/go/pkg/mod/go.uber.org/goleak@v1.1.12/testmain.go:53 +0x59
  github.com/pingcap/tidb/infoschema.TestMain()
      /home/genius/project/src/github.com/pingcap/tidb/infoschema/main_test.go:31 +0x315
  main.main()
      _testmain.go:217 +0x3f7

Goroutine 47 (finished) created at:
  github.com/pingcap/tidb/util.(*WaitGroupWrapper).Run()
      /home/genius/project/src/github.com/pingcap/tidb/util/wait_group_wrapper.go:31 +0xdc
  github.com/pingcap/tidb/executor.(*slowQueryRetriever).parseSlowLog()
      /home/genius/project/src/github.com/pingcap/tidb/executor/slow_query.go:477 +0xb50
  github.com/pingcap/tidb/executor.(*slowQueryRetriever).parseDataForSlowLog()
      /home/genius/project/src/github.com/pingcap/tidb/executor/slow_query.go:199 +0x1c4
  github.com/pingcap/tidb/executor.(*slowQueryRetriever).initializeAsyncParsing.func1()
      /home/genius/project/src/github.com/pingcap/tidb/executor/slow_query.go:1102 +0x71
==================

@tiancaiamao
Copy link
Contributor Author

WARNING: DATA RACE
Read at 0x00c004d485d0 by goroutine 89:
  github.com/pingcap/tidb/executor.(*slowQueryRuntimeStats).String()
      /home/genius/project/src/github.com/pingcap/tidb/executor/slow_query.go:978 +0x7c
  github.com/pingcap/tidb/util/execdetails.(*RootRuntimeStats).String()
      /home/genius/project/src/github.com/pingcap/tidb/util/execdetails/execdetails.go:518 +0x482
  github.com/pingcap/tidb/planner/core.getRuntimeInfo()
      /home/genius/project/src/github.com/pingcap/tidb/planner/core/common_plans.go:1469 +0x147
  github.com/pingcap/tidb/planner/core.(*planEncoder).encodePlan()
      /home/genius/project/src/github.com/pingcap/tidb/planner/core/encode.go:98 +0xf2
  github.com/pingcap/tidb/planner/core.(*planEncoder).encodePlanTree()
      /home/genius/project/src/github.com/pingcap/tidb/planner/core/encode.go:65 +0x10b
  github.com/pingcap/tidb/planner/core.EncodePlan()
      /home/genius/project/src/github.com/pingcap/tidb/planner/core/encode.go:58 +0x2b7
  github.com/pingcap/tidb/executor.getEncodedPlan()
      /home/genius/project/src/github.com/pingcap/tidb/executor/adapter.go:1186 +0x1d6
  github.com/pingcap/tidb/executor.(*ExecStmt).SummaryStmt.func1()
      /home/genius/project/src/github.com/pingcap/tidb/executor/adapter.go:1247 +0xb6
  github.com/pingcap/tidb/util/stmtsummary.newStmtSummaryByDigestElement()
      /home/genius/project/src/github.com/pingcap/tidb/util/stmtsummary/statement_summary.go:601 +0x71
  github.com/pingcap/tidb/util/stmtsummary.(*stmtSummaryByDigest).add.func1()
      /home/genius/project/src/github.com/pingcap/tidb/util/stmtsummary/statement_summary.go:557 +0x264
  github.com/pingcap/tidb/util/stmtsummary.(*stmtSummaryByDigest).add()
      /home/genius/project/src/github.com/pingcap/tidb/util/stmtsummary/statement_summary.go:568 +0x54
  github.com/pingcap/tidb/util/stmtsummary.(*stmtSummaryByDigestMap).AddStatement()
      /home/genius/project/src/github.com/pingcap/tidb/util/stmtsummary/statement_summary.go:339 +0x4d1
  github.com/pingcap/tidb/executor.(*ExecStmt).SummaryStmt()
      /home/genius/project/src/github.com/pingcap/tidb/executor/adapter.go:1323 +0x1878
  github.com/pingcap/tidb/executor.(*ExecStmt).FinishExecuteStmt()
      /home/genius/project/src/github.com/pingcap/tidb/executor/adapter.go:965 +0x5e4
  github.com/pingcap/tidb/executor.(*ExecStmt).CloseRecordSet()
      /home/genius/project/src/github.com/pingcap/tidb/executor/adapter.go:994 +0x50
  github.com/pingcap/tidb/executor.(*recordSet).Close()
      /home/genius/project/src/github.com/pingcap/tidb/executor/adapter.go:179 +0xb1
  github.com/pingcap/tidb/session.(*execStmtResult).Close()
      /home/genius/project/src/github.com/pingcap/tidb/session/session.go:2044 +0x6f
  github.com/pingcap/tidb/testkit.(*TestKit).QueryToErr()
      /home/genius/project/src/github.com/pingcap/tidb/testkit/testkit.go:157 +0x2cb
  github.com/pingcap/tidb/infoschema_test.TestSlowQueryOOM.func2()
      /home/genius/project/src/github.com/pingcap/tidb/infoschema/cluster_tables_test.go:688 +0x184
  github.com/pingcap/tidb/infoschema_test.TestSlowQueryOOM()
      /home/genius/project/src/github.com/pingcap/tidb/infoschema/cluster_tables_test.go:697 +0x98a
  testing.tRunner()
      /home/genius/project/go/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /home/genius/project/go/src/testing/testing.go:1486 +0x47

Previous write at 0x00c004d485d0 by goroutine 71:
  github.com/pingcap/tidb/executor.(*slowQueryRetriever).parseSlowLog()
      /home/genius/project/src/github.com/pingcap/tidb/executor/slow_query.go:457 +0x5ad
  github.com/pingcap/tidb/executor.(*slowQueryRetriever).parseDataForSlowLog()
      /home/genius/project/src/github.com/pingcap/tidb/executor/slow_query.go:199 +0x1c4
  github.com/pingcap/tidb/executor.(*slowQueryRetriever).initializeAsyncParsing.func1()
      /home/genius/project/src/github.com/pingcap/tidb/executor/slow_query.go:1102 +0x71

Goroutine 89 (running) created at:
  testing.(*T).Run()
      /home/genius/project/go/src/testing/testing.go:1486 +0x724
  testing.runTests.func1()
      /home/genius/project/go/src/testing/testing.go:1839 +0x99
  testing.tRunner()
      /home/genius/project/go/src/testing/testing.go:1439 +0x213
  testing.runTests()
      /home/genius/project/go/src/testing/testing.go:1837 +0x7e4
  testing.(*M).Run()
      /home/genius/project/go/src/testing/testing.go:1719 +0xa71
  go.uber.org/goleak.VerifyTestMain()
      /home/genius/go/pkg/mod/go.uber.org/goleak@v1.1.12/testmain.go:53 +0x59
  github.com/pingcap/tidb/infoschema.TestMain()
      /home/genius/project/src/github.com/pingcap/tidb/infoschema/main_test.go:31 +0x315
  main.main()
      _testmain.go:217 +0x3f7

Goroutine 71 (running) created at:
  github.com/pingcap/tidb/executor.(*slowQueryRetriever).initializeAsyncParsing()
      /home/genius/project/src/github.com/pingcap/tidb/executor/slow_query.go:1102 +0x174
  github.com/pingcap/tidb/executor.(*slowQueryRetriever).retrieve()
      /home/genius/project/src/github.com/pingcap/tidb/executor/slow_query.go:83 +0x14b
  github.com/pingcap/tidb/executor.(*MemTableReaderExec).Next()
      /home/genius/project/src/github.com/pingcap/tidb/executor/memtable_reader.go:118 +0x40d
  github.com/pingcap/tidb/executor.Next()
      /home/genius/project/src/github.com/pingcap/tidb/executor/executor.go:302 +0x53a
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      /home/genius/project/src/github.com/pingcap/tidb/executor/adapter.go:149 +0x134
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      /home/genius/project/src/github.com/pingcap/tidb/session/tidb.go:331 +0xea
  github.com/pingcap/tidb/testkit.(*TestKit).QueryToErr()
      /home/genius/project/src/github.com/pingcap/tidb/testkit/testkit.go:156 +0x2b1
  github.com/pingcap/tidb/infoschema_test.TestSlowQueryOOM.func2()
      /home/genius/project/src/github.com/pingcap/tidb/infoschema/cluster_tables_test.go:688 +0x184
  github.com/pingcap/tidb/infoschema_test.TestSlowQueryOOM()
      /home/genius/project/src/github.com/pingcap/tidb/infoschema/cluster_tables_test.go:697 +0x98a
  testing.tRunner()
      /home/genius/project/go/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /home/genius/project/go/src/testing/testing.go:1486 +0x47
==================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/test 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