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 TestHashPartitionAddRecord #53678

Closed
Tracked by #41316
hawkingrei opened this issue May 30, 2024 · 0 comments · Fixed by #53798
Closed
Tracked by #41316

DATA RACE in the TestHashPartitionAddRecord #53678

hawkingrei opened this issue May 30, 2024 · 0 comments · Fixed by #53798
Labels
component/test feature/developing the related feature is in development 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 0x00c00299c640 by goroutine 42905:
  reflect.Value.pointer()
      GOROOT/src/reflect/value.go:113 +0x276
  reflect.Value.Pointer()
      GOROOT/src/reflect/value.go:2162 +0x264
  github.com/pingcap/tidb/pkg/infoschema/internal.sizeOf()
      pkg/infoschema/internal/sizer.go:86 +0x399
  github.com/pingcap/tidb/pkg/infoschema/internal.sizeOf()
      pkg/infoschema/internal/sizer.go:53 +0xcc4
  github.com/pingcap/tidb/pkg/infoschema/internal.sizeOf()
      pkg/infoschema/internal/sizer.go:64 +0xaa7
  github.com/pingcap/tidb/pkg/infoschema/internal.sizeOf()
      pkg/infoschema/internal/sizer.go:93 +0x604
  github.com/pingcap/tidb/pkg/infoschema/internal.sizeOf()
      pkg/infoschema/internal/sizer.go:141 +0x207
  github.com/pingcap/tidb/pkg/infoschema/internal.sizeOf()
      pkg/infoschema/internal/sizer.go:64 +0xaa7
  github.com/pingcap/tidb/pkg/infoschema/internal.Sizeof()
      pkg/infoschema/internal/sizer.go:28 +0x1b7
  github.com/pingcap/tidb/pkg/infoschema.(*entry[go.shape.struct { github.com/pingcap/tidb/pkg/infoschema.tableID int64; github.com/pingcap/tidb/pkg/infoschema.schemaVersion int64 },go.shape.interface { AddRecord(github.com/pingcap/tidb/pkg/table/context.MutateContext, []github.com/pingcap/tidb/pkg/types.Datum, ...github.com/pingcap/tidb/pkg/table.AddRecordOption) (github.com/pingcap/tidb/pkg/kv.Handle, error); Allocators(github.com/pingcap/tidb/pkg/table/context.AllocatorContext) github.com/pingcap/tidb/pkg/meta/autoid.Allocators; Cols() []*github.com/pingcap/tidb/pkg/table.Column; DeletableCols() []*github.com/pingcap/tidb/pkg/table.Column; FullHiddenColsAndVisibleCols() []*github.com/pingcap/tidb/pkg/table.Column; GetPartitionedTable() github.com/pingcap/tidb/pkg/table.PartitionedTable; HiddenCols() []*github.com/pingcap/tidb/pkg/table.Column; IndexPrefix() github.com/pingcap/tidb/pkg/kv.Key; Indices() []github.com/pingcap/tidb/pkg/table.Index; Meta() *github.com/pingcap/tidb/pkg/parser/model.TableInfo; RecordPrefix() github.com/pingcap/tidb/pkg/kv.Key; RemoveRecord(github.com/pingcap/tidb/pkg/table/context.MutateContext, github.com/pingcap/tidb/pkg/kv.Handle, []github.com/pingcap/tidb/pkg/types.Datum) error; Type() github.com/pingcap/tidb/pkg/table.Type; UpdateRecord(context.Context, github.com/pingcap/tidb/pkg/table/context.MutateContext, github.com/pingcap/tidb/pkg/kv.Handle, []github.com/pingcap/tidb/pkg/types.Datum, []github.com/pingcap/tidb/pkg/types.Datum, []bool) error; VisibleCols() []*github.com/pingcap/tidb/pkg/table.Column; WritableCols() []*github.com/pingcap/tidb/pkg/table.Column }]).Size()
      pkg/infoschema/sieve.go:36 +0x67
  github.com/pingcap/tidb/pkg/infoschema.(*Sieve[go.shape.struct { github.com/pingcap/tidb/pkg/infoschema.tableID int64; github.com/pingcap/tidb/pkg/infoschema.schemaVersion int64 },go.shape.interface { AddRecord(github.com/pingcap/tidb/pkg/table/context.MutateContext, []github.com/pingcap/tidb/pkg/types.Datum, ...github.com/pingcap/tidb/pkg/table.AddRecordOption) (github.com/pingcap/tidb/pkg/kv.Handle, error); Allocators(github.com/pingcap/tidb/pkg/table/context.AllocatorContext) github.com/pingcap/tidb/pkg/meta/autoid.Allocators; Cols() []*github.com/pingcap/tidb/pkg/table.Column; DeletableCols() []*github.com/pingcap/tidb/pkg/table.Column; FullHiddenColsAndVisibleCols() []*github.com/pingcap/tidb/pkg/table.Column; GetPartitionedTable() github.com/pingcap/tidb/pkg/table.PartitionedTable; HiddenCols() []*github.com/pingcap/tidb/pkg/table.Column; IndexPrefix() github.com/pingcap/tidb/pkg/kv.Key; Indices() []github.com/pingcap/tidb/pkg/table.Index; Meta() *github.com/pingcap/tidb/pkg/parser/model.TableInfo; RecordPrefix() github.com/pingcap/tidb/pkg/kv.Key; RemoveRecord(github.com/pingcap/tidb/pkg/table/context.MutateContext, github.com/pingcap/tidb/pkg/kv.Handle, []github.com/pingcap/tidb/pkg/types.Datum) error; Type() github.com/pingcap/tidb/pkg/table.Type; UpdateRecord(context.Context, github.com/pingcap/tidb/pkg/table/context.MutateContext, github.com/pingcap/tidb/pkg/kv.Handle, []github.com/pingcap/tidb/pkg/types.Datum, []github.com/pingcap/tidb/pkg/types.Datum, []bool) error; VisibleCols() []*github.com/pingcap/tidb/pkg/table.Column; WritableCols() []*github.com/pingcap/tidb/pkg/table.Column }]).Set()
      pkg/infoschema/sieve.go:102 +0x3bd
  github.com/pingcap/tidb/pkg/infoschema.(*infoschemaV2).TableByName()
      pkg/infoschema/infoschema_v2.go:396 +0x764
  github.com/pingcap/tidb/pkg/infoschema.(*SessionExtendedInfoSchema).TableByName()
      pkg/infoschema/infoschema.go:749 +0x2e3
  github.com/pingcap/tidb/pkg/planner/core.(*preprocessor).tableByName()
      pkg/planner/core/preprocess.go:496 +0x3d6
  github.com/pingcap/tidb/pkg/planner/core.(*preprocessor).handleTableName()
      pkg/planner/core/preprocess.go:1576 +0x2f9
  github.com/pingcap/tidb/pkg/planner/core.(*preprocessor).Leave()
      pkg/planner/core/preprocess.go:597 +0x367
  github.com/pingcap/tidb/pkg/parser/ast.(*TableName).Accept()
      pkg/parser/ast/dml.go:452 +0x1dc
  github.com/pingcap/tidb/pkg/parser/ast.(*TableSource).Accept()
      pkg/parser/ast/dml.go:604 +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:827 +0x8b
  github.com/pingcap/tidb/pkg/parser/ast.(*SelectStmt).Accept()
      pkg/parser/ast/dml.go:1499 +0x50b
  github.com/pingcap/tidb/pkg/planner/core.Preprocess()
      pkg/planner/core/preprocess.go:138 +0x354
  github.com/pingcap/tidb/pkg/executor.(*Compiler).Compile()
      pkg/executor/compiler.go:67 +0x47c
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      pkg/session/session.go:2094 +0xe93
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteInternal()
      pkg/session/session.go:1519 +0x3b9
  github.com/pingcap/tidb/pkg/timer/tablestore.executeSQL()
      pkg/timer/tablestore/store.go:438 +0x16f
  github.com/pingcap/tidb/pkg/timer/tablestore.(*tableTimerStoreCore).List()
      pkg/timer/tablestore/store.go:141 +0x2ec
  github.com/pingcap/tidb/pkg/timer/runtime.(*TimerGroupRuntime).fullRefreshTimers()
      pkg/timer/runtime/runtime.go:234 +0x128
  github.com/pingcap/tidb/pkg/timer/runtime.(*TimerGroupRuntime).loop()
      pkg/timer/runtime/runtime.go:186 +0x6ee
  github.com/pingcap/tidb/pkg/timer/runtime.(*TimerGroupRuntime).loop-fm()
      <autogenerated>:1 +0x3d
  github.com/pingcap/tidb/pkg/timer/runtime.withRecoverUntil.func1()
      pkg/timer/runtime/runtime.go:494 +0x45
  github.com/pingcap/tidb/pkg/util.WithRecovery()
      pkg/util/misc.go:97 +0x77
  github.com/pingcap/tidb/pkg/timer/runtime.withRecoverUntil()
      pkg/timer/runtime/runtime.go:493 +0xcd
  github.com/pingcap/tidb/pkg/timer/runtime.(*TimerGroupRuntime).Start.func1()
      pkg/timer/runtime/runtime.go:127 +0x7b
  github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).Run.func1()
      pkg/util/wait_group_wrapper.go:157 +0x86
Previous write at 0x00c00299c640 by goroutine 38327:
  github.com/pingcap/tidb/pkg/table/tables.(*TableCommon).getCols()
      pkg/table/tables/tables.go:341 +0x1cc
  github.com/pingcap/tidb/pkg/table/tables.(*TableCommon).Cols.func1()
      pkg/table/tables/tables.go:351 +0xe7
  sync.(*Once).doSlow()
      GOROOT/src/sync/once.go:74 +0xf0
  sync.(*Once).Do()
      GOROOT/src/sync/once.go:65 +0x44
  github.com/pingcap/tidb/pkg/table/tables.(*TableCommon).Cols()
      pkg/table/tables/tables.go:348 +0x7e
  github.com/pingcap/tidb/pkg/planner/core.(*PlanBuilder).buildDataSource()
      pkg/planner/core/logical_plan_builder.go:4875 +0x68ee
  github.com/pingcap/tidb/pkg/planner/core.(*PlanBuilder).buildResultSetNode()
      pkg/planner/core/logical_plan_builder.go:449 +0x25a
  github.com/pingcap/tidb/pkg/planner/core.(*PlanBuilder).buildJoin()
      pkg/planner/core/logical_plan_builder.go:934 +0xfa5
  github.com/pingcap/tidb/pkg/planner/core.(*PlanBuilder).buildResultSetNode()
      pkg/planner/core/logical_plan_builder.go:435 +0xe4
  github.com/pingcap/tidb/pkg/planner/core.(*PlanBuilder).buildTableRefs()
      pkg/planner/core/logical_plan_builder.go:427 +0x117
  github.com/pingcap/tidb/pkg/planner/core.(*PlanBuilder).buildSelect()
      pkg/planner/core/logical_plan_builder.go:4106 +0xb2d
  github.com/pingcap/tidb/pkg/planner/core.(*PlanBuilder).Build()
      pkg/planner/core/planbuilder.go:515 +0xbb1
  github.com/pingcap/tidb/pkg/planner.buildLogicalPlan()
      pkg/planner/optimize.go:549 +0x311
  github.com/pingcap/tidb/pkg/planner.optimize()
      pkg/planner/optimize.go:466 +0xd04
  github.com/pingcap/tidb/pkg/planner.Optimize()
      pkg/planner/optimize.go:334 +0x2737
  github.com/pingcap/tidb/pkg/executor.(*Compiler).Compile()
      pkg/executor/compiler.go:99 +0x7ea
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      pkg/session/session.go:2094 +0xe93
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteInternal()
      pkg/session/session.go:1519 +0x3b9
  github.com/pingcap/tidb/pkg/timer/tablestore.executeSQL()
      pkg/timer/tablestore/store.go:438 +0x16f
  github.com/pingcap/tidb/pkg/timer/tablestore.(*tableTimerStoreCore).List()
      pkg/timer/tablestore/store.go:141 +0x2ec
  github.com/pingcap/tidb/pkg/timer/api.(*defaultTimerClient).GetTimers()
      pkg/timer/api/client.go:188 +0x13a
  github.com/pingcap/tidb/pkg/ttl/ttlworker.(*TTLTimersSyncer).SyncTimers()
      pkg/ttl/ttlworker/timer_sync.go:166 +0x33a
  github.com/pingcap/tidb/pkg/ttl/ttlworker.(*JobManager).onTimerTick()
      pkg/ttl/ttlworker/job_manager.go:306 +0x409
  github.com/pingcap/tidb/pkg/ttl/ttlworker.(*JobManager).jobLoop()
      pkg/ttl/ttlworker/job_manager.go:205 +0x127b
  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
Goroutine 42905 (running) created at:
  github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).Run()
      pkg/util/wait_group_wrapper.go:155 +0xe4
  github.com/pingcap/tidb/pkg/timer/runtime.(*TimerGroupRuntime).Start()
      pkg/timer/runtime/runtime.go:126 +0x1eb
  github.com/pingcap/tidb/pkg/ttl/ttlworker.(*ttlTimerRuntime).Resume()
      pkg/ttl/ttlworker/timer.go:283 +0x35b
  github.com/pingcap/tidb/pkg/ttl/ttlworker.(*JobManager).onTimerTick()
      pkg/ttl/ttlworker/job_manager.go:295 +0x2b1
  github.com/pingcap/tidb/pkg/ttl/ttlworker.(*JobManager).jobLoop()
      pkg/ttl/ttlworker/job_manager.go:205 +0x127b
  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
Goroutine 38327 (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:2990 +0x1c9
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      pkg/session/session.go:3533 +0x1b71
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:146 +0x974
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func204()
      pkg/sessionctx/variable/sysvar.go:1067 +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:145 +0x904
  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadSysVarCacheLoop()
      pkg/domain/domain.go:1747 +0x93
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      pkg/session/session.go:3426 +0x864
  github.com/pingcap/tidb/pkg/domain.(*Domain).GetSessionCache()
      pkg/domain/sysvar_cache.go:61 +0x50
  github.com/pingcap/tidb/pkg/session.(*session).loadCommonGlobalVariablesIfNeeded()
      pkg/session/session.go:3794 +0x2ce
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      pkg/session/session.go:2008 +0x184
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteInternal()
      pkg/session/session.go:1519 +0x3b9
  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadPrivilegeLoop()
      pkg/domain/domain.go:1690 +0x108
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      pkg/session/session.go:3419 +0x804
  github.com/pingcap/tidb/pkg/session.BootstrapSession()
      pkg/session/session.go:3318 +0xad
  github.com/pingcap/tidb/pkg/testkit.bootstrap()
      pkg/testkit/mockstore.go:294 +0x94
  github.com/pingcap/tidb/pkg/testkit.CreateMockStoreAndDomain()
      pkg/testkit/mockstore.go:265 +0xd2
  pkg/table/tables/test/partition/partition_test.TestHashPartitionAddRecord()
      pkg/table/tables/test/partition/partition_test.go:143 +0x4c
  testing.tRunner()
      GOROOT/src/testing/testing.go:1595 +0x261
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1648 +0x44
================== 

https://tiprow.hawkingrei.com/view/gs/pingcapprow/logs/tidb_data_race/1796052159523983360#1:build-log.txt%3A18078

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 feature/developing the related feature is in development 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.

3 participants