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 the TableReaderExecutor #33701

Closed
Tracked by #33745
hawkingrei opened this issue Apr 3, 2022 · 0 comments · Fixed by #33702 or #33781
Closed
Tracked by #33745

DATA RACE in the TableReaderExecutor #33701

hawkingrei opened this issue Apr 3, 2022 · 0 comments · Fixed by #33702 or #33781
Labels
component/test severity/minor 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)

==================
WARNING: DATA RACE
Write at 0x00c009b9c3d0 by goroutine 125:
  github.com/pingcap/tidb/sessionctx/variable.(*SessionVars).InitStatementContext()
      /go/tidb/sessionctx/variable/session.go:1034 +0x1e4
  github.com/pingcap/tidb/executor.ResetContextOfStmt()
      /go/tidb/executor/executor.go:1755 +0x12f
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      /go/tidb/session/session.go:1845 +0x384
  github.com/pingcap/tidb/session.(*session).Execute()
      /go/tidb/session/session.go:1534 +0x478
  github.com/pingcap/tidb/util/ddl-checker.(*ExecutableChecker).Execute()
      /go/tidb/util/ddl-checker/executable_checker.go:69 +0x72
  github.com/pingcap/tidb/util/ddl-checker.TestExecute()
      /go/tidb/util/ddl-checker/executable_checker_test.go:81 +0x284
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1486 +0x47
Previous write at 0x00c009b9c3d0 by goroutine 89:
  sync/atomic.AddInt32()
      /usr/local/go/src/runtime/race_amd64.s:279 +0xb
  sync/atomic.AddInt32()
      <autogenerated>:1 +0x1a
  github.com/pingcap/tidb/util/memory.(*Tracker).getParent.func1()
      /go/tidb/util/memory/tracker.go:506 +0x39
  runtime.deferreturn()
      /usr/local/go/src/runtime/panic.go:436 +0x32
  github.com/pingcap/tidb/util/memory.(*Tracker).Consume()
      /go/tidb/util/memory/tracker.go:313 +0x5a
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).sendToRespCh()
      /go/tidb/store/copr/coprocessor.go:553 +0x1a9
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleCopResponse()
      /go/tidb/store/copr/coprocessor.go:1025 +0x237c
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce()
      /go/tidb/store/copr/coprocessor.go:792 +0x1a74
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask()
      /go/tidb/store/copr/coprocessor.go:676 +0x1e5
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).run()
      /go/tidb/store/copr/coprocessor.go:418 +0x173
  github.com/pingcap/tidb/store/copr.(*copIterator).open.func1()
      /go/tidb/store/copr/coprocessor.go:450 +0x58
Goroutine 125 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1486 +0x724
  testing.runTests.func1()
      /usr/local/go/src/testing/testing.go:1839 +0x99
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.runTests()
      /usr/local/go/src/testing/testing.go:1837 +0x7e4
  testing.(*M).Run()
      /usr/local/go/src/testing/testing.go:1719 +0xa71
  main.main()
      _testmain.go:49 +0x2e4
Goroutine 89 (finished) created at:
  github.com/pingcap/tidb/store/copr.(*copIterator).open()
      /go/tidb/store/copr/coprocessor.go:450 +0xc4
  github.com/pingcap/tidb/store/copr.(*CopClient).Send()
      /go/tidb/store/copr/coprocessor.go:143 +0x10c9
  github.com/pingcap/tidb/distsql.Select()
      /go/tidb/distsql/distsql.go:101 +0x8c3
  github.com/pingcap/tidb/distsql.SelectWithRuntimeStats()
      /go/tidb/distsql/distsql.go:150 +0xbb
  github.com/pingcap/tidb/executor.selectResultHook.SelectResult()
      /go/tidb/executor/table_reader.go:53 +0x1c5
  github.com/pingcap/tidb/executor.(*TableReaderExecutor).buildResp()
      /go/tidb/executor/table_reader.go:310 +0x69d
  github.com/pingcap/tidb/executor.(*TableReaderExecutor).Open()
      /go/tidb/executor/table_reader.go:210 +0x13f5
  github.com/pingcap/tidb/executor.(*ExecStmt).Exec()
      /go/tidb/executor/adapter.go:407 +0x7f8
  github.com/pingcap/tidb/session.runStmt()
      /go/tidb/session/session.go:2017 +0x6cb
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      /go/tidb/session/session.go:1894 +0xd3a
  github.com/pingcap/tidb/session.(*session).Execute()
      /go/tidb/session/session.go:1534 +0x478
  github.com/pingcap/tidb/util/ddl-checker.(*ExecutableChecker).Execute()
      /go/tidb/util/ddl-checker/executable_checker.go:69 +0x72
  github.com/pingcap/tidb/util/ddl-checker.TestExecute()
      /go/tidb/util/ddl-checker/executable_checker_test.go:81 +0x284
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1486 +0x47
==================
==================
WARNING: DATA RACE
Write at 0x00c009b9c3d8 by goroutine 125:
  github.com/pingcap/tidb/sessionctx/variable.(*SessionVars).InitStatementContext()
      /go/tidb/sessionctx/variable/session.go:1034 +0x1e4
  github.com/pingcap/tidb/executor.ResetContextOfStmt()
      /go/tidb/executor/executor.go:1755 +0x12f
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      /go/tidb/session/session.go:1845 +0x384
  github.com/pingcap/tidb/session.(*session).Execute()
      /go/tidb/session/session.go:1534 +0x478
  github.com/pingcap/tidb/util/ddl-checker.(*ExecutableChecker).Execute()
      /go/tidb/util/ddl-checker/executable_checker.go:69 +0x72
  github.com/pingcap/tidb/util/ddl-checker.TestExecute()
      /go/tidb/util/ddl-checker/executable_checker_test.go:81 +0x284
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1486 +0x47
Previous read at 0x00c009b9c3d8 by goroutine 89:
  github.com/pingcap/tidb/util/memory.(*Tracker).getParent()
      /go/tidb/util/memory/tracker.go:507 +0x94
  github.com/pingcap/tidb/util/memory.(*Tracker).Consume()
      /go/tidb/util/memory/tracker.go:313 +0x5a
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).sendToRespCh()
      /go/tidb/store/copr/coprocessor.go:553 +0x1a9
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleCopResponse()
      /go/tidb/store/copr/coprocessor.go:1025 +0x237c
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce()
      /go/tidb/store/copr/coprocessor.go:792 +0x1a74
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask()
      /go/tidb/store/copr/coprocessor.go:676 +0x1e5
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).run()
      /go/tidb/store/copr/coprocessor.go:418 +0x173
  github.com/pingcap/tidb/store/copr.(*copIterator).open.func1()
      /go/tidb/store/copr/coprocessor.go:450 +0x58
Goroutine 125 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1486 +0x724
  testing.runTests.func1()
      /usr/local/go/src/testing/testing.go:1839 +0x99
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.runTests()
      /usr/local/go/src/testing/testing.go:1837 +0x7e4
  testing.(*M).Run()
      /usr/local/go/src/testing/testing.go:1719 +0xa71
  main.main()
      _testmain.go:49 +0x2e4
Goroutine 89 (finished) created at:
  github.com/pingcap/tidb/store/copr.(*copIterator).open()
      /go/tidb/store/copr/coprocessor.go:450 +0xc4
  github.com/pingcap/tidb/store/copr.(*CopClient).Send()
      /go/tidb/store/copr/coprocessor.go:143 +0x10c9
  github.com/pingcap/tidb/distsql.Select()
      /go/tidb/distsql/distsql.go:101 +0x8c3
  github.com/pingcap/tidb/distsql.SelectWithRuntimeStats()
      /go/tidb/distsql/distsql.go:150 +0xbb
  github.com/pingcap/tidb/executor.selectResultHook.SelectResult()
      /go/tidb/executor/table_reader.go:53 +0x1c5
  github.com/pingcap/tidb/executor.(*TableReaderExecutor).buildResp()
      /go/tidb/executor/table_reader.go:310 +0x69d
  github.com/pingcap/tidb/executor.(*TableReaderExecutor).Open()
      /go/tidb/executor/table_reader.go:210 +0x13f5
  github.com/pingcap/tidb/executor.(*ExecStmt).Exec()
      /go/tidb/executor/adapter.go:407 +0x7f8
  github.com/pingcap/tidb/session.runStmt()
      /go/tidb/session/session.go:2017 +0x6cb
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      /go/tidb/session/session.go:1894 +0xd3a
  github.com/pingcap/tidb/session.(*session).Execute()
      /go/tidb/session/session.go:1534 +0x478
  github.com/pingcap/tidb/util/ddl-checker.(*ExecutableChecker).Execute()
      /go/tidb/util/ddl-checker/executable_checker.go:69 +0x72
  github.com/pingcap/tidb/util/ddl-checker.TestExecute()
      /go/tidb/util/ddl-checker/executable_checker_test.go:81 +0x284
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1486 +0x47
==================
==================
WARNING: DATA RACE
Write at 0x00c009b9c3e8 by goroutine 125:
  github.com/pingcap/tidb/sessionctx/variable.(*SessionVars).InitStatementContext()
      /go/tidb/sessionctx/variable/session.go:1034 +0x1e4
  github.com/pingcap/tidb/executor.ResetContextOfStmt()
      /go/tidb/executor/executor.go:1755 +0x12f
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      /go/tidb/session/session.go:1845 +0x384
  github.com/pingcap/tidb/session.(*session).Execute()
      /go/tidb/session/session.go:1534 +0x478
  github.com/pingcap/tidb/util/ddl-checker.(*ExecutableChecker).Execute()
      /go/tidb/util/ddl-checker/executable_checker.go:69 +0x72
  github.com/pingcap/tidb/util/ddl-checker.TestExecute()
      /go/tidb/util/ddl-checker/executable_checker_test.go:81 +0x284
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1486 +0x47
Previous write at 0x00c009b9c3e8 by goroutine 89:
  sync/atomic.AddInt64()
      /usr/local/go/src/runtime/race_amd64.s:287 +0xb
  sync/atomic.AddInt64()
      <autogenerated>:1 +0x1b
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).sendToRespCh()
      /go/tidb/store/copr/coprocessor.go:553 +0x1a9
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleCopResponse()
      /go/tidb/store/copr/coprocessor.go:1025 +0x237c
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce()
      /go/tidb/store/copr/coprocessor.go:792 +0x1a74
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask()
      /go/tidb/store/copr/coprocessor.go:676 +0x1e5
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).run()
      /go/tidb/store/copr/coprocessor.go:418 +0x173
  github.com/pingcap/tidb/store/copr.(*copIterator).open.func1()
      /go/tidb/store/copr/coprocessor.go:450 +0x58
Goroutine 125 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1486 +0x724
  testing.runTests.func1()
      /usr/local/go/src/testing/testing.go:1839 +0x99
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.runTests()
      /usr/local/go/src/testing/testing.go:1837 +0x7e4
  testing.(*M).Run()
      /usr/local/go/src/testing/testing.go:1719 +0xa71
  main.main()
      _testmain.go:49 +0x2e4
Goroutine 89 (finished) created at:
  github.com/pingcap/tidb/store/copr.(*copIterator).open()
      /go/tidb/store/copr/coprocessor.go:450 +0xc4
  github.com/pingcap/tidb/store/copr.(*CopClient).Send()
      /go/tidb/store/copr/coprocessor.go:143 +0x10c9
  github.com/pingcap/tidb/distsql.Select()
      /go/tidb/distsql/distsql.go:101 +0x8c3
  github.com/pingcap/tidb/distsql.SelectWithRuntimeStats()
      /go/tidb/distsql/distsql.go:150 +0xbb
  github.com/pingcap/tidb/executor.selectResultHook.SelectResult()
      /go/tidb/executor/table_reader.go:53 +0x1c5
  github.com/pingcap/tidb/executor.(*TableReaderExecutor).buildResp()
      /go/tidb/executor/table_reader.go:310 +0x69d
  github.com/pingcap/tidb/executor.(*TableReaderExecutor).Open()
      /go/tidb/executor/table_reader.go:210 +0x13f5
  github.com/pingcap/tidb/executor.(*ExecStmt).Exec()
      /go/tidb/executor/adapter.go:407 +0x7f8
  github.com/pingcap/tidb/session.runStmt()
      /go/tidb/session/session.go:2017 +0x6cb
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      /go/tidb/session/session.go:1894 +0xd3a
  github.com/pingcap/tidb/session.(*session).Execute()
      /go/tidb/session/session.go:1534 +0x478
  github.com/pingcap/tidb/util/ddl-checker.(*ExecutableChecker).Execute()
      /go/tidb/util/ddl-checker/executable_checker.go:69 +0x72
  github.com/pingcap/tidb/util/ddl-checker.TestExecute()
      /go/tidb/util/ddl-checker/executable_checker_test.go:81 +0x284
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1486 +0x47
================== 

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

3. What did you see instead (Required)

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/minor type/bug The issue is confirmed as a bug.
Projects
None yet
2 participants