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

p-dml: race risk when concurrent accessing txn options #52028

Closed
you06 opened this issue Mar 22, 2024 · 0 comments · Fixed by #51913
Closed

p-dml: race risk when concurrent accessing txn options #52028

you06 opened this issue Mar 22, 2024 · 0 comments · Fixed by #51913
Labels
affects-8.0 severity/major sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.

Comments

@you06
Copy link
Contributor

you06 commented Mar 22, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Run go test ./tests/realtikvtest/pipelineddmltest --tags=intest -race

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

test pass

3. What did you see instead (Required)

race detected

WARNING: DATA RACE
Read at 0x00c0314bd978 by goroutine 78928:
  github.com/tikv/client-go/v2/txnkv/transaction.(*twoPhaseCommitter).buildPipelinedFlushRequest()
      github.com/tikv/client-go/v2@v2.0.8-0.20240320090330-ab337d6c51d2/txnkv/transaction/pipelined_flush.go:108 +0x7f4
  github.com/tikv/client-go/v2/txnkv/transaction.actionPipelinedFlush.handleSingleBatch()
      github.com/tikv/client-go/v2@v2.0.8-0.20240320090330-ab337d6c51d2/txnkv/transaction/pipelined_flush.go:124 +0x1fc
  github.com/tikv/client-go/v2/txnkv/transaction.(*actionPipelinedFlush).handleSingleBatch()
      <autogenerated>:1 +0x9c
  github.com/tikv/client-go/v2/txnkv/transaction.(*twoPhaseCommitter).doActionOnBatches()
      github.com/tikv/client-go/v2@v2.0.8-0.20240320090330-ab337d6c51d2/txnkv/transaction/2pc.go:1095 +0x66c
  github.com/tikv/client-go/v2/txnkv/transaction.(*twoPhaseCommitter).doActionOnGroupMutations()
      github.com/tikv/client-go/v2@v2.0.8-0.20240320090330-ab337d6c51d2/txnkv/transaction/2pc.go:1056 +0x163c
  github.com/tikv/client-go/v2/txnkv/transaction.(*twoPhaseCommitter).doActionOnMutations()
      github.com/tikv/client-go/v2@v2.0.8-0.20240320090330-ab337d6c51d2/txnkv/transaction/2pc.go:815 +0xf8
  github.com/tikv/client-go/v2/txnkv/transaction.(*twoPhaseCommitter).pipelinedFlushMutations()
      github.com/tikv/client-go/v2@v2.0.8-0.20240320090330-ab337d6c51d2/txnkv/transaction/pipelined_flush.go:281 +0x25c
  github.com/tikv/client-go/v2/txnkv/transaction.(*KVTxn).InitPipelinedMemDB.func2()
      github.com/tikv/client-go/v2@v2.0.8-0.20240320090330-ab337d6c51d2/txnkv/transaction/txn.go:555 +0x1350
  github.com/tikv/client-go/v2/internal/unionstore.(*PipelinedMemDB).Flush.func1()
      github.com/tikv/client-go/v2@v2.0.8-0.20240320090330-ab337d6c51d2/internal/unionstore/pipelined_memdb.go:314 +0x19c
  github.com/tikv/client-go/v2/internal/unionstore.(*PipelinedMemDB).Flush.gowrap1()
      github.com/tikv/client-go/v2@v2.0.8-0.20240320090330-ab337d6c51d2/internal/unionstore/pipelined_memdb.go:320 +0x44

Previous write at 0x00c0314bd978 by goroutine 58977:
  github.com/tikv/client-go/v2/txnkv/transaction.(*KVTxn).SetResourceGroupTagger()
      github.com/tikv/client-go/v2@v2.0.8-0.20240320090330-ab337d6c51d2/txnkv/transaction/txn.go:316 +0xcc
  github.com/pingcap/tidb/pkg/store/driver/txn.(*tikvTxn).SetOption()
      github.com/pingcap/tidb/pkg/store/driver/txn/txn_driver.go:254 +0xa4c
  github.com/pingcap/tidb/pkg/session.(*session).doCommit()
      github.com/pingcap/tidb/pkg/session/session.go:581 +0xb18
  github.com/pingcap/tidb/pkg/session.(*session).doCommitWithRetry()
      github.com/pingcap/tidb/pkg/session/session.go:882 +0x294
  github.com/pingcap/tidb/pkg/session.(*session).CommitTxn()
      github.com/pingcap/tidb/pkg/session/session.go:1009 +0x128
  github.com/pingcap/tidb/pkg/session.autoCommitAfterStmt()
      github.com/pingcap/tidb/pkg/session/tidb.go:281 +0x354
  github.com/pingcap/tidb/pkg/session.finishStmt()
      github.com/pingcap/tidb/pkg/session/tidb.go:243 +0x300
  github.com/pingcap/tidb/pkg/session.runStmt()
      github.com/pingcap/tidb/pkg/session/session.go:2394 +0x67c
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      github.com/pingcap/tidb/pkg/session/session.go:2245 +0x12cc
  github.com/pingcap/tidb/pkg/testkit.(*TestKit).ExecWithContext()
      github.com/pingcap/tidb/pkg/testkit/testkit.go:365 +0xadc
  github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExecWithContext()
      github.com/pingcap/tidb/pkg/testkit/testkit.go:137 +0x64
  github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExec()
      github.com/pingcap/tidb/pkg/testkit/testkit.go:132 +0xd8
  github.com/pingcap/tidb/tests/realtikvtest/pipelineddmltest.TestPipelinedDMLInsert()

4. What is your TiDB version? (Required)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-8.0 severity/major 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