Skip to content

DATA RACE in ttlworker.(*taskManager).resizeDelWorkers #40811

Closed
@hawkingrei

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

==================
WARNING: DATA RACE
Read at 0x00c013c04558 by goroutine 111298:
  github.com/pingcap/tidb/ttl/ttlworker.(*taskManager).resizeDelWorkers()
      ttl/ttlworker/task_manager.go:169 +0x64
  github.com/pingcap/tidb/ttl/ttlworker.(*taskManager).resizeWorkersWithSysVar()
      ttl/ttlworker/task_manager.go:109 +0x224
  github.com/pingcap/tidb/ttl/ttlworker.(*taskManager).ResizeWorkersWithSysVar()
      ttl/ttlworker/task_manager_test.go:44 +0x151
  github.com/pingcap/tidb/ttl/ttlworker_test.TestTriggerScanTask()
      ttl/ttlworker/job_manager_integration_test.go:442 +0x13d
  github.com/pingcap/tidb/domain.(*Domain).rebuildSysVarCache()
      domain/sysvar_cache.go:146 +0x844
  github.com/pingcap/tidb/domain.(*Domain).LoadSysVarCacheLoop()
      domain/domain.go:1384 +0xa8
  github.com/pingcap/tidb/session.BootstrapSession()
      session/session.go:3337 +0x693
  github.com/pingcap/tidb/domain.(*Domain).GetSessionCache()
      domain/sysvar_cache.go:62 +0x59
  github.com/pingcap/tidb/session.(*session).loadCommonGlobalVariablesIfNeeded()
      session/session.go:3656 +0x104
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      session/session.go:2134 +0x2a5
  github.com/pingcap/tidb/session.(*session).ExecuteInternal()
      session/session.go:1668 +0x471
  github.com/pingcap/tidb/domain.(*Domain).LoadPrivilegeLoop()
      domain/domain.go:1328 +0x130
  github.com/pingcap/tidb/session.BootstrapSession()
      session/session.go:3330 +0x644
  github.com/pingcap/tidb/testkit.bootstrap()
      testkit/mockstore.go:85 +0xac
  github.com/pingcap/tidb/testkit.CreateMockStoreAndDomain()
      testkit/mockstore.go:70 +0xe9
  github.com/pingcap/tidb/ttl/ttlworker_test.TestTriggerScanTask()
      ttl/ttlworker/job_manager_integration_test.go:434 +0x58
  testing.tRunner()
      GOROOT/src/testing/testing.go:1446 +0x216
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1493 +0x47
Previous write at 0x00c013c04558 by goroutine 124348:
  github.com/pingcap/tidb/ttl/ttlworker.(*taskManager).resizeDelWorkers()
      ttl/ttlworker/task_manager.go:169 +0xaa
  github.com/pingcap/tidb/ttl/ttlworker.(*taskManager).resizeWorkersWithSysVar()
      ttl/ttlworker/task_manager.go:109 +0x224
  github.com/pingcap/tidb/ttl/ttlworker.(*JobManager).jobLoop()
      ttl/ttlworker/job_manager.go:159 +0x50d
  github.com/pingcap/tidb/ttl/ttlworker.(*JobManager).jobLoop-fm()
      <autogenerated>:1 +0x39
  github.com/pingcap/tidb/ttl/ttlworker.(*baseWorker).loop()
      ttl/ttlworker/worker.go:134 +0xa3
  github.com/pingcap/tidb/ttl/ttlworker.(*baseWorker).loop-fm()
      <autogenerated>:1 +0x39
  github.com/pingcap/tidb/util.(*WaitGroupWrapper).Run.func1()
      util/wait_group_wrapper.go:154 +0x73
Goroutine 111298 (running) created at:
  testing.(*T).Run()
      GOROOT/src/testing/testing.go:1493 +0x75d
  testing.runTests.func1()
      GOROOT/src/testing/testing.go:1846 +0x99
  testing.tRunner()
      GOROOT/src/testing/testing.go:1446 +0x216
  testing.runTests()
      GOROOT/src/testing/testing.go:1844 +0x7ec
  testing.(*M).Run()
      GOROOT/src/testing/testing.go:1726 +0xa84
  main.main()
      bazel-out/k8-fastbuild/bin/ttl/ttlworker/ttlworker_test_/testmain.go:148 +0x5d0
Goroutine 124348 (running) created at:
  github.com/pingcap/tidb/util.(*WaitGroupWrapper).Run()
      util/wait_group_wrapper.go:152 +0xe4
  github.com/pingcap/tidb/ttl/ttlworker.(*baseWorker).Start()
      ttl/ttlworker/worker.go:71 +0x12d
  github.com/pingcap/tidb/domain.(*Domain).StartTTLJobManager.func1()
      domain/domain.go:2498 +0x1a4
  github.com/pingcap/tidb/util.(*WaitGroupEnhancedWrapper).Run.func1()
      util/wait_group_wrapper.go:96 +0xb7 

2. What did you expect to see? (Required)

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

Activity

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

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions