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 HelperTestAdminShowNextID #55828

Closed
hawkingrei opened this issue Sep 3, 2024 · 1 comment · Fixed by #56002
Closed

DATA RACE in the HelperTestAdminShowNextID #55828

hawkingrei opened this issue Sep 3, 2024 · 1 comment · Fixed by #56002
Labels
component/test severity/minor sig/sql-infra SIG: SQL Infra 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
Read at 0x00000df2b460 by goroutine 12004:
  github.com/pingcap/tidb/pkg/meta/autoid.NewAllocator()
      pkg/meta/autoid/autoid.go:611 +0x1a4
  github.com/pingcap/tidb/pkg/meta/autoid.NewAllocatorsFromTblInfo()
      pkg/meta/autoid/autoid.go:663 +0xe2e
  github.com/pingcap/tidb/pkg/infoschema.(*infoschemaV2).loadTableInfo.func1()
      pkg/infoschema/infoschema_v2.go:1093 +0x1b8
  golang.org/x/sync/singleflight.(*Group).doCall.func2()
      external/org_golang_x_sync/singleflight/singleflight.go:198 +0xc3
  golang.org/x/sync/singleflight.(*Group).doCall()
      external/org_golang_x_sync/singleflight/singleflight.go:200 +0x153
  golang.org/x/sync/singleflight.(*Group).Do()
      external/org_golang_x_sync/singleflight/singleflight.go:113 +0x204
  github.com/pingcap/tidb/pkg/infoschema.(*infoschemaV2).loadTableInfo()
      pkg/infoschema/infoschema_v2.go:1062 +0x385
  github.com/pingcap/tidb/pkg/infoschema.(*infoschemaV2).TableByName()
      pkg/infoschema/infoschema_v2.go:750 +0x817
  github.com/pingcap/tidb/pkg/infoschema.(*SessionExtendedInfoSchema).TableByName()
      pkg/infoschema/infoschema.go:802 +0x2ef
  github.com/pingcap/tidb/pkg/planner/core.(*preprocessor).tableByName()
      pkg/planner/core/preprocess.go:506 +0x432
  github.com/pingcap/tidb/pkg/planner/core.(*preprocessor).handleTableName()
      pkg/planner/core/preprocess.go:1613 +0x2f9
  github.com/pingcap/tidb/pkg/planner/core.(*preprocessor).Leave()
      pkg/planner/core/preprocess.go:611 +0x367
  github.com/pingcap/tidb/pkg/parser/ast.(*TableName).Accept()
      pkg/parser/ast/dml.go:449 +0x1dc
  github.com/pingcap/tidb/pkg/parser/ast.(*TableSource).Accept()
      pkg/parser/ast/dml.go:601 +0x90
  github.com/pingcap/tidb/pkg/parser/ast.(*Join).Accept()
      pkg/parser/ast/dml.go:244 +0xb9
  github.com/pingcap/tidb/pkg/parser/ast.(*TableRefsClause).Accept()
      pkg/parser/ast/dml.go:824 +0x8b
  github.com/pingcap/tidb/pkg/parser/ast.(*SelectStmt).Accept()
      pkg/parser/ast/dml.go:1496 +0x50b
  github.com/pingcap/tidb/pkg/parser/ast.(*TableSource).Accept()
      pkg/parser/ast/dml.go:601 +0x90
  github.com/pingcap/tidb/pkg/parser/ast.(*Join).Accept()
      pkg/parser/ast/dml.go:244 +0xb9
  github.com/pingcap/tidb/pkg/parser/ast.(*TableRefsClause).Accept()
      pkg/parser/ast/dml.go:824 +0x8b
  github.com/pingcap/tidb/pkg/parser/ast.(*SelectStmt).Accept()
      pkg/parser/ast/dml.go:1496 +0x50b
  github.com/pingcap/tidb/pkg/planner/core.Preprocess()
      pkg/planner/core/preprocess.go:143 +0x501
  github.com/pingcap/tidb/pkg/executor.(*Compiler).Compile()
      pkg/executor/compiler.go:69 +0x584
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      pkg/session/session.go:2093 +0xe93
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteInternal()
      pkg/session/session.go:1518 +0x3b9
  github.com/pingcap/tidb/pkg/ttl/session.(*session).ExecuteSQL()
      pkg/ttl/session/session.go:93 +0x15d
  github.com/pingcap/tidb/pkg/ttl/ttlworker.GetDelayMetricRecords()
      pkg/ttl/ttlworker/job_manager.go:1052 +0xa4
  github.com/pingcap/tidb/pkg/ttl/ttlworker.(*JobManager).reportMetrics()
      pkg/ttl/ttlworker/job_manager.go:503 +0x326
  github.com/pingcap/tidb/pkg/ttl/ttlworker.(*JobManager).jobLoop()
      pkg/ttl/ttlworker/job_manager.go:197 +0xb64
  github.com/pingcap/tidb/pkg/ttl/ttlworker.(*JobManager).jobLoop-fm()
      <autogenerated>:1 +0x33
  github.com/pingcap/tidb/pkg/ttl/ttlworker.(*baseWorker).loop()
      pkg/ttl/ttlworker/worker.go:134 +0xbb
  github.com/pingcap/tidb/pkg/ttl/ttlworker.(*baseWorker).loop-fm()
      <autogenerated>:1 +0x33
  github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).Run.func1()
      pkg/util/wait_group_wrapper.go:157 +0x86
Previous write at 0x00000df2b460 by goroutine 64:
  github.com/pingcap/tidb/pkg/meta/autoid.SetStep()
      pkg/meta/autoid/autoid.go:281 +0x124
  pkg/executor/test/seqtest/seqtest_test_test.HelperTestAdminShowNextID()
      pkg/executor/test/seqtest/seq_executor_test.go:776 +0x117
  github.com/pingcap/failpoint.parseTerm()
      external/com_github_pingcap_failpoint/terms.go:149 +0x364
  github.com/pingcap/failpoint.parse()
      external/com_github_pingcap_failpoint/terms.go:126 +0xa5
  github.com/pingcap/failpoint.newTerms()
      external/com_github_pingcap_failpoint/terms.go:98 +0x3e
  github.com/pingcap/failpoint.(*Failpoint).Enable()
      external/com_github_pingcap_failpoint/failpoint.go:58 +0x3e
  github.com/pingcap/failpoint.(*Failpoints).Enable()
      external/com_github_pingcap_failpoint/failpoints.go:105 +0x296
  github.com/pingcap/failpoint.Enable()
      external/com_github_pingcap_failpoint/failpoints.go:255 +0x75
  pkg/executor/test/seqtest/seqtest_test_test.HelperTestAdminShowNextID()
      pkg/executor/test/seqtest/seq_executor_test.go:770 +0x76
  pkg/executor/test/seqtest/seqtest_test_test.TestAdminShowNextID()
      pkg/executor/test/seqtest/seq_executor_test.go:765 +0x64
  fmt.Sscanf()
      GOROOT/src/fmt/scan.go:114 +0x18e
  github.com/pingcap/tidb/pkg/sessionctx/variable.parseByteSize()
      pkg/sessionctx/variable/varsutil.go:406 +0x1d
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func252()
      pkg/sessionctx/variable/sysvar.go:1371 +0x34
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:143 +0x9b4
  fmt.Sscanf()
      GOROOT/src/fmt/scan.go:114 +0x18e
  github.com/pingcap/tidb/pkg/sessionctx/variable.parseByteSize()
      pkg/sessionctx/variable/varsutil.go:406 +0x1d
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func250()
      pkg/sessionctx/variable/sysvar.go:1356 +0x34
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:143 +0x9b4
  github.com/pingcap/tidb/pkg/sessionctx/variable.parseMemoryLimit()
      pkg/sessionctx/variable/varsutil.go:375 +0x18b
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func209()
      pkg/sessionctx/variable/sysvar.go:1106 +0x50
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:143 +0x9b4
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func208()
      pkg/sessionctx/variable/sysvar.go:1099 +0x58
  github.com/pingcap/tidb/pkg/sessionctx/variable.(*SysVar).ValidateWithRelaxedValidation()
      pkg/sessionctx/variable/variable.go:365 +0x23e
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:142 +0x944
  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadSysVarCacheLoop()
      pkg/domain/domain.go:1854 +0x93
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      pkg/session/session.go:3518 +0x844
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func250()
      pkg/sessionctx/variable/sysvar.go:1356 +0x34
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:143 +0x9b4
  github.com/pingcap/tidb/pkg/sessionctx/variable.parseSchemaCacheSize()
      pkg/sessionctx/variable/varsutil.go:628 +0x17c
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func607()
      pkg/sessionctx/variable/sysvar.go:3234 +0x64
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:143 +0x9b4
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func606()
      pkg/sessionctx/variable/sysvar.go:3226 +0x58
  github.com/pingcap/tidb/pkg/sessionctx/variable.(*SysVar).ValidateWithRelaxedValidation()
      pkg/sessionctx/variable/variable.go:365 +0x23e
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:142 +0x944
  fmt.Sscanf()
      GOROOT/src/fmt/scan.go:114 +0x18e
  github.com/pingcap/tidb/pkg/sessionctx/variable.parseByteSize()
      pkg/sessionctx/variable/varsutil.go:406 +0x1d
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func252()
      pkg/sessionctx/variable/sysvar.go:1371 +0x34
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:143 +0x9b4
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCacheIfNeeded()
      pkg/domain/sysvar_cache.go:50 +0x1b5
  github.com/pingcap/tidb/pkg/domain.(*Domain).GetSessionCache()
      pkg/domain/sysvar_cache.go:61 +0x4d
  github.com/pingcap/tidb/pkg/session.(*session).loadCommonGlobalVariablesIfNeeded()
      pkg/session/session.go:3886 +0x2bb
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      pkg/session/session.go:2007 +0x184
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteInternal()
      pkg/session/session.go:1518 +0x3b9
  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadPrivilegeLoop()
      pkg/domain/domain.go:1797 +0x108
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      pkg/session/session.go:3511 +0x7e7
  github.com/pingcap/tidb/pkg/session.BootstrapSession()
      pkg/session/session.go:3389 +0xad
  github.com/pingcap/tidb/pkg/testkit.bootstrap()
      pkg/testkit/mockstore.go:254 +0x94
  github.com/pingcap/tidb/pkg/testkit.CreateMockStoreAndDomain()
      pkg/testkit/mockstore.go:225 +0xd2
  github.com/pingcap/tidb/pkg/testkit.CreateMockStore()
      pkg/testkit/mockstore.go:70 +0x3dd
  pkg/executor/test/seqtest/seqtest_test_test.TestAdminShowNextID()
      pkg/executor/test/seqtest/seq_executor_test.go:763 +0x3c
  testing.tRunner()
      GOROOT/src/testing/testing.go:1595 +0x261
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1648 +0x44
Goroutine 12004 (running) created at:
  github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).Run()
      pkg/util/wait_group_wrapper.go:155 +0xe4
  github.com/pingcap/tidb/pkg/ttl/ttlworker.(*baseWorker).Start()
      pkg/ttl/ttlworker/worker.go:71 +0x12e
  github.com/pingcap/tidb/pkg/domain.(*Domain).StartTTLJobManager()
      pkg/domain/domain.go:3080 +0x1db
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      pkg/session/session.go:3628 +0x1c65
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:143 +0x9b4
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func606()
      pkg/sessionctx/variable/sysvar.go:3226 +0x58
  github.com/pingcap/tidb/pkg/sessionctx/variable.(*SysVar).ValidateWithRelaxedValidation()
      pkg/sessionctx/variable/variable.go:365 +0x23e
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:142 +0x944
  fmt.Sscanf()
      GOROOT/src/fmt/scan.go:114 +0x18e
  github.com/pingcap/tidb/pkg/sessionctx/variable.parseByteSize()
      pkg/sessionctx/variable/varsutil.go:406 +0x1d
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func252()
      pkg/sessionctx/variable/sysvar.go:1371 +0x34
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:143 +0x9b4
  fmt.Sscanf()
      GOROOT/src/fmt/scan.go:114 +0x18e
  github.com/pingcap/tidb/pkg/sessionctx/variable.parseByteSize()
      pkg/sessionctx/variable/varsutil.go:406 +0x1d
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func250()
      pkg/sessionctx/variable/sysvar.go:1356 +0x34
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:143 +0x9b4
  github.com/pingcap/tidb/pkg/sessionctx/variable.parseMemoryLimit()
      pkg/sessionctx/variable/varsutil.go:375 +0x18b
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func209()
      pkg/sessionctx/variable/sysvar.go:1106 +0x50
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:143 +0x9b4
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func208()
      pkg/sessionctx/variable/sysvar.go:1099 +0x58
  github.com/pingcap/tidb/pkg/sessionctx/variable.(*SysVar).ValidateWithRelaxedValidation()
      pkg/sessionctx/variable/variable.go:365 +0x23e
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:142 +0x944
  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadSysVarCacheLoop()
      pkg/domain/domain.go:1854 +0x93
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      pkg/session/session.go:3518 +0x844
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func250()
      pkg/sessionctx/variable/sysvar.go:1356 +0x34
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:143 +0x9b4
  github.com/pingcap/tidb/pkg/sessionctx/variable.parseSchemaCacheSize()
      pkg/sessionctx/variable/varsutil.go:628 +0x17c
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func607()
      pkg/sessionctx/variable/sysvar.go:3234 +0x64
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:143 +0x9b4
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func606()
      pkg/sessionctx/variable/sysvar.go:3226 +0x58
  github.com/pingcap/tidb/pkg/sessionctx/variable.(*SysVar).ValidateWithRelaxedValidation()
      pkg/sessionctx/variable/variable.go:365 +0x23e
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:142 +0x944
  fmt.Sscanf()
      GOROOT/src/fmt/scan.go:114 +0x18e
  github.com/pingcap/tidb/pkg/sessionctx/variable.parseByteSize()
      pkg/sessionctx/variable/varsutil.go:406 +0x1d
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func252()
      pkg/sessionctx/variable/sysvar.go:1371 +0x34
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:143 +0x9b4
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCacheIfNeeded()
      pkg/domain/sysvar_cache.go:50 +0x1b5
  github.com/pingcap/tidb/pkg/domain.(*Domain).GetSessionCache()
      pkg/domain/sysvar_cache.go:61 +0x4d
  github.com/pingcap/tidb/pkg/session.(*session).loadCommonGlobalVariablesIfNeeded()
      pkg/session/session.go:3886 +0x2bb
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      pkg/session/session.go:2007 +0x184
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteInternal()
      pkg/session/session.go:1518 +0x3b9
  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadPrivilegeLoop()
      pkg/domain/domain.go:1797 +0x108
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      pkg/session/session.go:3511 +0x7e7
  github.com/pingcap/tidb/pkg/session.BootstrapSession()
      pkg/session/session.go:3389 +0xad
  github.com/pingcap/tidb/pkg/testkit.bootstrap()
      pkg/testkit/mockstore.go:254 +0x94
  github.com/pingcap/tidb/pkg/testkit.CreateMockStoreAndDomain()
      pkg/testkit/mockstore.go:225 +0xd2
  github.com/pingcap/tidb/pkg/testkit.CreateMockStore()
      pkg/testkit/mockstore.go:70 +0x3dd
  pkg/executor/test/seqtest/seqtest_test_test.TestAdminShowNextID()
      pkg/executor/test/seqtest/seq_executor_test.go:763 +0x3c
  testing.tRunner()
      GOROOT/src/testing/testing.go:1595 +0x261
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1648 +0x44
Goroutine 64 (running) created at:
  testing.(*T).Run()
      GOROOT/src/testing/testing.go:1648 +0x845
  testing.runTests.func1()
      GOROOT/src/testing/testing.go:2054 +0x84
  testing.tRunner()
      GOROOT/src/testing/testing.go:1595 +0x261
  testing.runTests()
      GOROOT/src/testing/testing.go:2052 +0x8ad
  testing.(*M).Run()
      GOROOT/src/testing/testing.go:1925 +0xcd7
  go.uber.org/goleak.VerifyTestMain()
      external/org_uber_go_goleak/testmain.go:53 +0x64
  pkg/executor/test/seqtest/seqtest_test.TestMain()
      pkg/executor/test/seqtest/main_test.go:39 +0x636
  main.main()
      bazel-out/k8-fastbuild/bin/pkg/executor/test/seqtest/seqtest_test_/testmain.go:183 +0x744
================== 

4. What is your TiDB version? (Required)

@hawkingrei hawkingrei added the type/bug The issue is confirmed as a bug. label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/test severity/minor sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants