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 TestWriteMultiValuedIndex #53863

Closed
Tracked by #41316
hawkingrei opened this issue Jun 6, 2024 · 1 comment
Closed
Tracked by #41316

DATA RACE in the TestWriteMultiValuedIndex #53863

hawkingrei opened this issue Jun 6, 2024 · 1 comment

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 0x00c002953548 by goroutine 40689:
  reflect.Value.Pointer()
      GOROOT/src/reflect/value.go:2182 +0x1a4
  github.com/pingcap/tidb/pkg/infoschema/internal.sizeOf()
      pkg/infoschema/internal/sizer.go:47 +0x6d3
  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:445 +0x764
  github.com/pingcap/tidb/pkg/infoschema.(*SessionExtendedInfoSchema).TableByName()
      pkg/infoschema/infoschema.go:769 +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/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
Previous write at 0x00c002953548 by goroutine 45584:
  github.com/pingcap/tidb/pkg/table/tables.(*TableCommon).Cols.func1()
      pkg/table/tables/tables.go:352 +0x225
  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:349 +0x7e
  github.com/pingcap/tidb/pkg/planner/core.(*PlanBuilder).buildDataSource()
      pkg/planner/core/logical_plan_builder.go:4876 +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:4107 +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/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
Goroutine 40689 (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:3010 +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:1755 +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:1698 +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:254 +0x94
  github.com/pingcap/tidb/pkg/testkit.CreateMockStoreAndDomain()
      pkg/testkit/mockstore.go:225 +0xd2
  pkg/expression/test/multivaluedindex/multivaluedindex_test.TestWriteMultiValuedIndex()
      pkg/expression/test/multivaluedindex/multi_valued_index_test.go:34 +0x54
  testing.tRunner()
      GOROOT/src/testing/testing.go:1595 +0x261
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1648 +0x44
Goroutine 45584 (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
================== 

4. What is your TiDB version? (Required)

@lance6716
Copy link
Contributor

fixed by #53798

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants