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 TestInitStatsVer2 #42122

Open
Tracked by #41316
hawkingrei opened this issue Mar 12, 2023 · 1 comment · Fixed by #42123
Open
Tracked by #41316

DATA RACE in the TestInitStatsVer2 #42122

hawkingrei opened this issue Mar 12, 2023 · 1 comment · Fixed by #42123
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 0x00c007b7ea33 by goroutine 48:
  github.com/pingcap/tidb/session.(*session).ExecuteInternal()
      session/session.go:1612 +0x118
  github.com/pingcap/tidb/statistics/handle.(*Handle).initTopNCountSum()
      statistics/handle/bootstrap.go:343 +0x205
  github.com/pingcap/tidb/statistics/handle.(*Handle).initStatsHistograms4Chunk()
      statistics/handle/bootstrap.go:146 +0xb7a
  github.com/pingcap/tidb/statistics/handle.(*Handle).initStatsHistograms()
      statistics/handle/bootstrap.go:187 +0x2a4
  github.com/pingcap/tidb/statistics/handle.(*Handle).InitStats()
      statistics/handle/bootstrap.go:420 +0x275
  statistics/handle/handletest/handletest_test.TestInitStatsVer2()
      statistics/handle/handletest/handle_test.go:478 +0x264
  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
  statistics/handle/handletest/handletest_test.TestInitStatsVer2()
      statistics/handle/handletest/handle_test.go:462 +0x58
  testing.tRunner()
      GOROOT/src/testing/testing.go:1576 +0x216
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1629 +0x47
Previous read at 0x00c007b7ea33 by goroutine 30154:
  github.com/pingcap/tidb/distsql.(*selectResult).fetchResp.func1()
      distsql/select_result.go:165 +0x90
  runtime.deferreturn()
      GOROOT/src/runtime/panic.go:476 +0x32
  github.com/pingcap/tidb/distsql.(*selectResult).Next()
      distsql/select_result.go:262 +0x198
  github.com/pingcap/tidb/executor.(*tableResultHandler).nextChunk()
      executor/table_reader.go:516 +0x1a5
  github.com/pingcap/tidb/executor.(*TableReaderExecutor).Next()
      executor/table_reader.go:255 +0x350
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:324 +0x326
  github.com/pingcap/tidb/executor.(*projectionInputFetcher).run()
      executor/projection.go:388 +0x5e4
  github.com/pingcap/tidb/executor.(*ProjectionExec).prepare.func1()
      executor/projection.go:277 +0x58
Goroutine 48 (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
  statistics/handle/handletest/handletest_test.TestMain()
      statistics/handle/handletest/main_test.go:32 +0x435
  main.main()
      bazel-out/k8-fastbuild/bin/statistics/handle/handletest/handletest_test_/testmain.go:246 +0x5e8
Goroutine 30154 (finished) created at:
  github.com/pingcap/tidb/executor.(*ProjectionExec).prepare()
      executor/projection.go:277 +0xd59
  github.com/pingcap/tidb/executor.(*ProjectionExec).parallelExecute()
      executor/projection.go:212 +0xd6
  github.com/pingcap/tidb/executor.(*ProjectionExec).Next()
      executor/projection.go:185 +0xcc
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:324 +0x326
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1211 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:149 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/statistics/handle.(*Handle).initStatsHistograms()
      statistics/handle/bootstrap.go:180 +0x2d5
  github.com/pingcap/tidb/statistics/handle.(*Handle).InitStats()
      statistics/handle/bootstrap.go:420 +0x275
  statistics/handle/handletest/handletest_test.TestInitStatsVer2()
      statistics/handle/handletest/handle_test.go:478 +0x264
  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
  statistics/handle/handletest/handletest_test.TestInitStatsVer2()
      statistics/handle/handletest/handle_test.go:462 +0x58
  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)

@tangenta
Copy link
Contributor

Reopen this because #42123 is reverted by #42542.

@tangenta tangenta reopened this Mar 24, 2023
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