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 TestReorgPartExtensivePart #51845

Closed
Tracked by #41316
hawkingrei opened this issue Mar 17, 2024 · 3 comments · Fixed by #53017
Closed
Tracked by #41316

DATA RACE TestReorgPartExtensivePart #51845

hawkingrei opened this issue Mar 17, 2024 · 3 comments · Fixed by #53017
Assignees
Labels
affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. affects-8.5 This bug affects the 8.5.x(LTS) versions. component/tablepartition This issue is related to Table Partition of TiDB. component/test severity/major 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 0x00c01e825198 by goroutine 36414:
  github.com/pingcap/tidb/pkg/table/tables.(*TableCommon).Meta()
      pkg/table/tables/tables.go:265 +0x3b
  github.com/pingcap/tidb/pkg/table/tables.(*partitionedTable).Meta()
      <autogenerated>:1 +0x17
  github.com/pingcap/tidb/pkg/ttl/ttlworker.(*TTLTimersSyncer).SyncTimers()
      pkg/ttl/ttlworker/timer_sync.go:189 +0x1859
  github.com/pingcap/tidb/pkg/ttl/ttlworker.(*JobManager).onTimerTick()
      pkg/ttl/ttlworker/job_manager.go:305 +0x409
  github.com/pingcap/tidb/pkg/ttl/ttlworker.(*JobManager).jobLoop()
      pkg/ttl/ttlworker/job_manager.go:204 +0x126d
  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 0x00c01e825198 by goroutine 146784:
  github.com/pingcap/tidb/pkg/table/tables.SwapReorgPartFields()
      pkg/table/tables/testutil.go:30 +0x25e
  pkg/table/tables/test/partition/partition_test.checkDMLInAllStates.func1()
      pkg/table/tables/test/partition/partition_test.go:2639 +0x15fb
  pkg/table/tables/test/partition/partition_test.(*testCallback).OnJobRunBefore()
      pkg/table/tables/test/partition/partition_test.go:2087 +0x65
  github.com/pingcap/tidb/pkg/ddl.(*worker).HandleDDLJobTable()
      pkg/ddl/ddl_worker.go:926 +0x33a
  github.com/pingcap/tidb/pkg/ddl.(*ddl).delivery2Worker.func1()
      pkg/ddl/job_table.go:462 +0x805
  github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).Run.func1()
      pkg/util/wait_group_wrapper.go:157 +0x86
Goroutine 36414 (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:2937 +0x1c9
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      pkg/session/session.go:3493 +0x1b51
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:147 +0x974
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func202()
      pkg/sessionctx/variable/sysvar.go:1035 +0x58
  github.com/pingcap/tidb/pkg/sessionctx/variable.(*SysVar).ValidateWithRelaxedValidation()
      pkg/sessionctx/variable/variable.go:365 +0x210
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      pkg/domain/sysvar_cache.go:146 +0x904
  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadSysVarCacheLoop()
      pkg/domain/domain.go:1730 +0x93
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      pkg/session/session.go:3386 +0x844
  github.com/pingcap/tidb/pkg/domain.(*Domain).GetSessionCache()
      pkg/domain/sysvar_cache.go:62 +0x50
  github.com/pingcap/tidb/pkg/session.(*session).loadCommonGlobalVariablesIfNeeded()
      pkg/session/session.go:3754 +0x2ce
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      pkg/session/session.go:2107 +0x184
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteInternal()
      pkg/session/session.go:1622 +0x3b9
  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadPrivilegeLoop()
      pkg/domain/domain.go:1673 +0x108
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      pkg/session/session.go:3379 +0x7e4
  github.com/pingcap/tidb/pkg/session.BootstrapSession()
      pkg/session/session.go:3286 +0xad
  github.com/pingcap/tidb/pkg/testkit.bootstrap()
      pkg/testkit/mockstore.go:290 +0x94
  github.com/pingcap/tidb/pkg/testkit.CreateMockStoreAndDomain()
      pkg/testkit/mockstore.go:263 +0xd5
  github.com/pingcap/tidb/pkg/testkit.CreateMockStore()
      pkg/testkit/mockstore.go:71 +0x3bd
  pkg/table/tables/test/partition/partition_test.TestReorgPartExtensivePart()
      pkg/table/tables/test/partition/partition_test.go:2434 +0x4c
  testing.tRunner()
      GOROOT/src/testing/testing.go:1595 +0x261
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1648 +0x44
Goroutine 146784 (running) created at:
  github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).Run()
      pkg/util/wait_group_wrapper.go:155 +0xe4
  github.com/pingcap/tidb/pkg/ddl.(*ddl).delivery2Worker()
      pkg/ddl/job_table.go:422 +0x1b3
  github.com/pingcap/tidb/pkg/ddl.(*ddl).loadDDLJobAndRun()
      pkg/ddl/job_table.go:378 +0x4ef
  github.com/pingcap/tidb/pkg/ddl.(*ddl).startDispatchLoop()
      pkg/ddl/job_table.go:313 +0xe55
  github.com/pingcap/tidb/pkg/ddl.(*ddl).startDispatchLoop-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)

@hawkingrei hawkingrei added the type/bug The issue is confirmed as a bug. label Mar 17, 2024
@aytrack aytrack added the component/tablepartition This issue is related to Table Partition of TiDB. label Mar 18, 2024
@djshow832
Copy link
Contributor

The author of TestReorgPartExtensivePart is @mjonss so I'm assigning it to @mjonss

@ti-chi-bot ti-chi-bot added the affects-8.1 This bug affects the 8.1.x(LTS) versions. label Apr 9, 2024
@mjonss
Copy link
Contributor

mjonss commented Apr 30, 2024

Still reproducable with (cd pkg/table/tables/test/partition ; go test -v -tags intest -race -run TestReorgPartExtensivePart -failfast -count 1000) on linux, using c24dca5

@mjonss
Copy link
Contributor

mjonss commented May 2, 2024

The issue is the way the test works, and not a race in the server code. The test is using a test-only function for swapping the partitioning struct directly on the server global table cache, which then causes a race when the TTL loop is checking each table for syncing their ttl timers.

so I would not consider this as a major bug, since it is a test only, and not very frequently hit.

@mjonss mjonss added affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. and removed may-affects-7.5 may-affects-7.1 affects-7.1 This bug affects the 7.1.x(LTS) versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 labels May 2, 2024
@ti-chi-bot ti-chi-bot added the affects-8.5 This bug affects the 8.5.x(LTS) versions. label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. affects-8.5 This bug affects the 8.5.x(LTS) versions. component/tablepartition This issue is related to Table Partition of TiDB. component/test severity/major 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.

5 participants