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 setDDLLabelForTopSQL #33613

Closed
hawkingrei opened this issue Mar 31, 2022 · 0 comments · Fixed by #33617
Closed

DATA RACE in the setDDLLabelForTopSQL #33613

hawkingrei opened this issue Mar 31, 2022 · 0 comments · Fixed by #33617
Assignees
Labels
component/test severity/minor 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)

==================
WARNING: DATA RACE
Write at 0x00c0222501b0 by goroutine 252:
  github.com/pingcap/tidb/ddl.(*jobContext).setDDLLabelForTopSQL()
      /go/tidb/ddl/ddl_worker.go:523 +0x36c
  github.com/pingcap/tidb/ddl.(*worker).handleDDLJobQueue.func1()
      /go/tidb/ddl/ddl_worker.go:583 +0x25c
  github.com/pingcap/tidb/kv.RunInNewTxn()
      /go/tidb/kv/txn.go:49 +0x155
  github.com/pingcap/tidb/ddl.(*worker).handleDDLJobQueue()
      /go/tidb/ddl/ddl_worker.go:564 +0x1cf
  github.com/pingcap/tidb/ddl.(*worker).start()
      /go/tidb/ddl/ddl_worker.go:204 +0x64f
  github.com/pingcap/tidb/ddl.(*ddl).Start.func3()
      /go/tidb/ddl/ddl.go:401 +0x47
Previous write at 0x00c0222501b0 by goroutine 195:
  github.com/pingcap/tidb/ddl.(*jobContext).setDDLLabelForTopSQL()
      /go/tidb/ddl/ddl_worker.go:523 +0x36c
  github.com/pingcap/tidb/ddl.(*backfillWorker).run()
      /go/tidb/ddl/backfilling.go:305 +0x2d1
  github.com/pingcap/tidb/ddl.(*worker).writePhysicalTableRecord.func2()
      /go/tidb/ddl/backfilling.go:648 +0x71
Goroutine 252 (running) created at:
  github.com/pingcap/tidb/ddl.(*ddl).Start()
      /go/tidb/ddl/ddl.go:401 +0x9f1
  github.com/pingcap/tidb/domain.(*Domain).Init()
      /go/tidb/domain/domain.go:855 +0x11d6
  github.com/pingcap/tidb/session.(*domainMap).Get.func1()
      /go/tidb/session/tidb.go:83 +0x664
  github.com/pingcap/tidb/util.RunWithRetry()
      /go/tidb/util/misc.go:65 +0x93
  github.com/pingcap/tidb/session.(*domainMap).Get()
      /go/tidb/session/tidb.go:71 +0x38b
  github.com/pingcap/tidb/session.createSessionWithOpt()
      /go/tidb/session/session.go:2942 +0x75
  github.com/pingcap/tidb/session.createSession()
      /go/tidb/session/session.go:2938 +0x84
  github.com/pingcap/tidb/session.createSessions()
      /go/tidb/session/session.go:2927 +0x6e
  github.com/pingcap/tidb/session.BootstrapSession()
      /go/tidb/session/session.go:2810 +0x297
  github.com/pingcap/tidb/ddl_test.(*stateChangeSuite).SetupSuite()
      /go/tidb/ddl/db_change_test.go:73 +0x1f9
  github.com/stretchr/testify/suite.Run()
      /home/prow/go/pkg/mod/github.com/stretchr/[email protected]/suite/suite.go:118 +0x597
  github.com/pingcap/tidb/ddl_test.TestStateChange()
      /go/tidb/ddl/db_change_test.go:63 +0x44
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1486 +0x47
Goroutine 195 (running) created at:
  github.com/pingcap/tidb/ddl.(*worker).writePhysicalTableRecord()
      /go/tidb/ddl/backfilling.go:648 +0x2059
  github.com/pingcap/tidb/ddl.(*worker).addPhysicalTableIndex()
      /go/tidb/ddl/index.go:1353 +0x284
  github.com/pingcap/tidb/ddl.(*worker).addTableIndex()
      /go/tidb/ddl/index.go:1376 +0xcc
  github.com/pingcap/tidb/ddl.(*worker).updateColumnAndIndexes()
      /go/tidb/ddl/column.go:1192 +0xef5
  github.com/pingcap/tidb/ddl.(*worker).doModifyColumnTypeWithData.func1()
      /go/tidb/ddl/column.go:1032 +0x314
  github.com/pingcap/tidb/ddl.(*worker).runReorgJob.func1()
      /go/tidb/ddl/reorg.go:227 +0x88
==================
==================
WARNING: DATA RACE
Write at 0x00c022250180 by goroutine 252:
  github.com/pingcap/tidb/ddl.(*jobContext).setDDLLabelForTopSQL()
      /go/tidb/ddl/ddl_worker.go:524 +0x3bd
  github.com/pingcap/tidb/ddl.(*worker).handleDDLJobQueue.func1()
      /go/tidb/ddl/ddl_worker.go:583 +0x25c
  github.com/pingcap/tidb/kv.RunInNewTxn()
      /go/tidb/kv/txn.go:49 +0x155
  github.com/pingcap/tidb/ddl.(*worker).handleDDLJobQueue()
      /go/tidb/ddl/ddl_worker.go:564 +0x1cf
  github.com/pingcap/tidb/ddl.(*worker).start()
      /go/tidb/ddl/ddl_worker.go:204 +0x64f
  github.com/pingcap/tidb/ddl.(*ddl).Start.func3()
      /go/tidb/ddl/ddl.go:401 +0x47
Previous write at 0x00c022250180 by goroutine 195:
  github.com/pingcap/tidb/ddl.(*jobContext).setDDLLabelForTopSQL()
      /go/tidb/ddl/ddl_worker.go:524 +0x3bd
  github.com/pingcap/tidb/ddl.(*backfillWorker).run()
      /go/tidb/ddl/backfilling.go:305 +0x2d1
  github.com/pingcap/tidb/ddl.(*worker).writePhysicalTableRecord.func2()
      /go/tidb/ddl/backfilling.go:648 +0x71
Goroutine 252 (running) created at:
  github.com/pingcap/tidb/ddl.(*ddl).Start()
      /go/tidb/ddl/ddl.go:401 +0x9f1
  github.com/pingcap/tidb/domain.(*Domain).Init()
      /go/tidb/domain/domain.go:855 +0x11d6
  github.com/pingcap/tidb/session.(*domainMap).Get.func1()
      /go/tidb/session/tidb.go:83 +0x664
  github.com/pingcap/tidb/util.RunWithRetry()
      /go/tidb/util/misc.go:65 +0x93
  github.com/pingcap/tidb/session.(*domainMap).Get()
      /go/tidb/session/tidb.go:71 +0x38b
  github.com/pingcap/tidb/session.createSessionWithOpt()
      /go/tidb/session/session.go:2942 +0x75
  github.com/pingcap/tidb/session.createSession()
      /go/tidb/session/session.go:2938 +0x84
  github.com/pingcap/tidb/session.createSessions()
      /go/tidb/session/session.go:2927 +0x6e
  github.com/pingcap/tidb/session.BootstrapSession()
      /go/tidb/session/session.go:2810 +0x297
  github.com/pingcap/tidb/ddl_test.(*stateChangeSuite).SetupSuite()
      /go/tidb/ddl/db_change_test.go:73 +0x1f9
  github.com/stretchr/testify/suite.Run()
      /home/prow/go/pkg/mod/github.com/stretchr/[email protected]/suite/suite.go:118 +0x597
  github.com/pingcap/tidb/ddl_test.TestStateChange()
      /go/tidb/ddl/db_change_test.go:63 +0x44
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1486 +0x47
Goroutine 195 (running) created at:
  github.com/pingcap/tidb/ddl.(*worker).writePhysicalTableRecord()
      /go/tidb/ddl/backfilling.go:648 +0x2059
  github.com/pingcap/tidb/ddl.(*worker).addPhysicalTableIndex()
      /go/tidb/ddl/index.go:1353 +0x284
  github.com/pingcap/tidb/ddl.(*worker).addTableIndex()
      /go/tidb/ddl/index.go:1376 +0xcc
  github.com/pingcap/tidb/ddl.(*worker).updateColumnAndIndexes()
      /go/tidb/ddl/column.go:1192 +0xef5
  github.com/pingcap/tidb/ddl.(*worker).doModifyColumnTypeWithData.func1()
      /go/tidb/ddl/column.go:1032 +0x314
  github.com/pingcap/tidb/ddl.(*worker).runReorgJob.func1()
      /go/tidb/ddl/reorg.go:227 +0x88
================== 

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

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

@hawkingrei hawkingrei added the type/bug The issue is confirmed as a bug. label Mar 31, 2022
@crazycs520 crazycs520 self-assigned this Mar 31, 2022
ti-chi-bot pushed a commit that referenced this issue Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/test severity/minor type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants