Skip to content

DATA RACE in the ActivateTxn #42092

Closed
@hawkingrei

Description

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)

Activity

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions