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 ActivateTxn #42092

Closed
Tracked by #41316
hawkingrei opened this issue Mar 10, 2023 · 1 comment · Fixed by #42960
Closed
Tracked by #41316

DATA RACE in the ActivateTxn #42092

hawkingrei opened this issue Mar 10, 2023 · 1 comment · Fixed by #42960
Labels
affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. component/test severity/moderate sig/transaction SIG:Transaction 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 0x00c029918568 by goroutine 102065:
  github.com/pingcap/tidb/sessiontxn/isolation.(*baseTxnContextProvider).ActivateTxn()
      sessiontxn/isolation/base.go:270 +0x6c
  github.com/pingcap/tidb/sessiontxn/isolation.(*OptimisticTxnContextProvider).ActivateTxn()
      <autogenerated>:1 +0x37
  github.com/pingcap/tidb/session.(*txnManager).ActivateTxn()
      session/txnmanager.go:262 +0x89
  github.com/pingcap/tidb/session.(*session).Txn()
      session/session.go:2501 +0x86
  github.com/pingcap/tidb/executor.(*InsertValues).allocAutoRandomID()
      executor/insert_common.go:1048 +0x3c2
  github.com/pingcap/tidb/executor.(*InsertValues).adjustAutoRandomDatum()
      executor/insert_common.go:1011 +0x87b
  github.com/pingcap/tidb/executor.(*InsertValues).fillColValue()
      executor/insert_common.go:622 +0x8fe
  github.com/pingcap/tidb/executor.(*InsertValues).fillRow()
      executor/insert_common.go:672 +0x735
  github.com/pingcap/tidb/executor.(*InsertValues).getRow()
      executor/insert_common.go:566 +0x6c7
  github.com/pingcap/tidb/executor.(*LoadDataWorker).parserData2TableData()
      executor/load_data.go:1143 +0x13b6
  github.com/pingcap/tidb/executor.(*LoadDataWorker).ReadRows()
      executor/load_data.go:1059 +0x430
  github.com/pingcap/tidb/executor.(*LoadDataWorker).processStream()
      executor/load_data.go:821 +0x251
  github.com/pingcap/tidb/executor.(*LoadDataWorker).Load.func3()
      executor/load_data.go:782 +0xbb
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      external/org_golang_x_sync/errgroup/errgroup.go:75 +0x82

Previous write at 0x00c029918568 by goroutine 102066:
  github.com/pingcap/tidb/sessiontxn/isolation.(*baseTxnContextProvider).ActivateTxn()
      sessiontxn/isolation/base.go:338 +0x9ab
  github.com/pingcap/tidb/sessiontxn/isolation.(*baseTxnContextProvider).OnInitialize()
      sessiontxn/isolation/base.go:135 +0xad3
  github.com/pingcap/tidb/sessiontxn/isolation.(*OptimisticTxnContextProvider).OnInitialize()
      <autogenerated>:1 +0x64
  github.com/pingcap/tidb/session.(*txnManager).EnterNewTxn()
      session/txnmanager.go:168 +0xa7
  github.com/pingcap/tidb/sessiontxn.NewTxn()
      sessiontxn/interface.go:224 +0x141
  github.com/pingcap/tidb/executor.(*LoadDataWorker).commitWork()
      executor/load_data.go:877 +0x13b
  github.com/pingcap/tidb/executor.(*LoadDataWorker).Load.func4()
      executor/load_data.go:786 +0x6a
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      external/org_golang_x_sync/errgroup/errgroup.go:75 +0x82

Goroutine 102065 (running) created at:
  golang.org/x/sync/errgroup.(*Group).Go()
      external/org_golang_x_sync/errgroup/errgroup.go:72 +0x12e
  github.com/pingcap/tidb/executor.(*LoadDataWorker).Load()
      executor/load_data.go:781 +0x14f1
  github.com/pingcap/tidb/server.(*clientConn).handleLoadData()
      server/conn.go:1622 +0x628
  github.com/pingcap/tidb/server.(*clientConn).handleFileTransInConn()
      server/conn.go:2044 +0x1f7
  github.com/pingcap/tidb/server.(*clientConn).handleStmt()
      server/conn.go:2023 +0x695
  github.com/pingcap/tidb/server.(*clientConn).handleQuery()
      server/conn.go:1845 +0xc9a
  github.com/pingcap/tidb/server.(*clientConn).dispatch()
      server/conn.go:1334 +0x153a
  github.com/pingcap/tidb/server.(*clientConn).Run()
      server/conn.go:1117 +0x46a
  github.com/pingcap/tidb/server.(*Server).onConn()
      server/server.go:675 +0x18f8
  github.com/pingcap/tidb/server.(*Server).startNetworkListener.func1()
      server/server.go:489 +0x47

Goroutine 102066 (running) created at:
  golang.org/x/sync/errgroup.(*Group).Go()
      external/org_golang_x_sync/errgroup/errgroup.go:72 +0x12e
  github.com/pingcap/tidb/executor.(*LoadDataWorker).Load()
      executor/load_data.go:785 +0x1625
  github.com/pingcap/tidb/server.(*clientConn).handleLoadData()
      server/conn.go:1622 +0x628
  github.com/pingcap/tidb/server.(*clientConn).handleFileTransInConn()
      server/conn.go:2044 +0x1f7
  github.com/pingcap/tidb/server.(*clientConn).handleStmt()
      server/conn.go:2023 +0x695
  github.com/pingcap/tidb/server.(*clientConn).handleQuery()
      server/conn.go:1845 +0xc9a
  github.com/pingcap/tidb/server.(*clientConn).dispatch()
      server/conn.go:1334 +0x153a
  github.com/pingcap/tidb/server.(*clientConn).Run()
      server/conn.go:1117 +0x46a
  github.com/pingcap/tidb/server.(*Server).onConn()
      server/server.go:675 +0x18f8
  github.com/pingcap/tidb/server.(*Server).startNetworkListener.func1()
      server/server.go:489 +0x47
==================

4. What is your TiDB version? (Required)

@hawkingrei hawkingrei added the type/bug The issue is confirmed as a bug. label Mar 10, 2023
@hawkingrei
Copy link
Member Author

==================

WARNING: DATA RACE

Write at 0x00c01a602398 by goroutine 88542:

  github.com/pingcap/tidb/sessiontxn/isolation.(*baseTxnContextProvider).ActivateTxn()

      sessiontxn/isolation/base.go:291 +0x292

  github.com/pingcap/tidb/sessiontxn/isolation.(*baseTxnContextProvider).GetStmtReadTS()

      sessiontxn/isolation/base.go:182 +0x44

  github.com/pingcap/tidb/sessiontxn/isolation.(*baseTxnContextProvider).GetSnapshotWithStmtReadTS()

      sessiontxn/isolation/base.go:424 +0x44

  github.com/pingcap/tidb/sessiontxn/isolation.(*OptimisticTxnContextProvider).GetSnapshotWithStmtReadTS()

      <autogenerated>:1 +0x37

  github.com/pingcap/tidb/session.(*txnManager).GetSnapshotWithStmtReadTS()

      session/txnmanager.go:147 +0x161

  github.com/pingcap/tidb/executor.(*executorBuilder).getSnapshot()

      executor/builder.go:1782 +0x16b

  github.com/pingcap/tidb/executor.(*executorBuilder).buildPointGet()

      executor/point_get.go:69 +0x624

  github.com/pingcap/tidb/executor.(*executorBuilder).build()

      executor/builder.go:184 +0x944

  github.com/pingcap/tidb/executor.(*ExecStmt).buildExecutor()

      executor/adapter.go:1150 +0x41a

  github.com/pingcap/tidb/executor.(*ExecStmt).Exec()

      executor/adapter.go:519 +0xae4

  github.com/pingcap/tidb/session.runStmt()

      session/session.go:2344 +0x701

  github.com/pingcap/tidb/session.(*session).ExecuteStmt()

      session/session.go:2201 +0x1338

  github.com/pingcap/tidb/session.(*session).ExecuteInternal()

      session/session.go:1638 +0x365

  github.com/pingcap/tidb/ddl/internal/session.(*Session).Execute()

      ddl/internal/session/session.go:85 +0x26d

  github.com/pingcap/tidb/ddl.checkMDLInfo()

      ddl/ddl_worker.go:483 +0x1c8

  github.com/pingcap/tidb/ddl.(*ddl).delivery2worker.func1()

      ddl/job_table.go:255 +0x364

  github.com/pingcap/tidb/util.(*WaitGroupWrapper).Run.func1()

      util/wait_group_wrapper.go:154 +0x87


Previous read at 0x00c01a602398 by goroutine 42539:

  github.com/pingcap/tidb/testkit.(*MockSessionManager).GetInternalSessionStartTSList()

      testkit/mocksessionmanager.go:149 +0x2d2

  github.com/pingcap/tidb/domain/infosync.(*InfoSyncer).ReportMinStartTS()

      domain/infosync/info.go:801 +0xc1

  github.com/pingcap/tidb/domain.(*Domain).infoSyncerKeeper()

      domain/domain.go:666 +0x51a

  github.com/pingcap/tidb/domain.(*Domain).infoSyncerKeeper-fm()

      <autogenerated>:1 +0x39

  github.com/pingcap/tidb/util.(*WaitGroupEnhancedWrapper).Run.func1()

      util/wait_group_wrapper.go:96 +0xde


Goroutine 88542 (running) created at:

  github.com/pingcap/tidb/util.(*WaitGroupWrapper).Run()

      util/wait_group_wrapper.go:152 +0xf6

  github.com/pingcap/tidb/ddl.(*ddl).delivery2worker()

      ddl/job_table.go:245 +0x1c4

  github.com/pingcap/tidb/ddl.(*ddl).loadDDLJobAndRun()

      ddl/job_table.go:238 +0x51c

  github.com/pingcap/tidb/ddl.(*ddl).startDispatchLoop()

      ddl/job_table.go:210 +0x919

  github.com/pingcap/tidb/ddl.(*ddl).startDispatchLoop-fm()

      <autogenerated>:1 +0x39

  github.com/pingcap/tidb/util.(*WaitGroupWrapper).Run.func1()

      util/wait_group_wrapper.go:154 +0x87


Goroutine 42539 (running) created at:

  github.com/pingcap/tidb/util.(*WaitGroupEnhancedWrapper).Run()

      util/wait_group_wrapper.go:91 +0x15a

  github.com/pingcap/tidb/domain.(*Domain).Init()

      domain/domain.go:1182 +0x14ed

  github.com/pingcap/tidb/session.(*domainMap).Get.func1()

      session/tidb.go:93 +0x67c

  github.com/pingcap/tidb/util.RunWithRetry()

      util/misc.go:69 +0xbe

  github.com/pingcap/tidb/session.(*domainMap).Get()

      session/tidb.go:79 +0x2f8

  github.com/pingcap/tidb/session.createSessionWithOpt()

      session/session.go:3529 +0x86

  github.com/pingcap/tidb/session.createSession()

      session/session.go:3525 +0x49

  github.com/pingcap/tidb/session.createSessions()

      session/session.go:3510 +0x9a

  github.com/pingcap/tidb/session.BootstrapSession()

      session/session.go:3285 +0x455

  github.com/pingcap/tidb/testkit.bootstrap()

      testkit/mockstore.go:85 +0x84

  github.com/pingcap/tidb/testkit.CreateMockStoreAndDomain()

      testkit/mockstore.go:70 +0xd0

  github.com/pingcap/tidb/testkit.CreateMockStore()

      testkit/mockstore.go:62 +0x3b2

  executor/autoidtest/autoidtest_test_test.TestAutoIncrementInsertMinMax()

      executor/autoidtest/autoid_test.go:99 +0x58

  testing.tRunner()

      GOROOT/src/testing/testing.go:1576 +0x216

  testing.(*T).Run.func1()

      GOROOT/src/testing/testing.go:1629 +0x47

==================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. component/test severity/moderate sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants