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 github.com/tikv/client-go/v2/internal/unionstore.(*memdbArena) #49793

Open
Tracked by #41316
hawkingrei opened this issue Dec 26, 2023 · 1 comment
Labels
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 0x00c015035060 by goroutine 53915:
  github.com/tikv/client-go/v2/internal/unionstore.(*nodeAllocator).getNode()
      external/com_github_tikv_client_go_v2/internal/unionstore/memdb_arena.go:251 +0x96
  github.com/tikv/client-go/v2/internal/unionstore.(*MemDB).getNode()
      external/com_github_tikv_client_go_v2/internal/unionstore/memdb.go:779 +0x29
  github.com/tikv/client-go/v2/internal/unionstore.(*MemDB).getRoot()
      external/com_github_tikv_client_go_v2/internal/unionstore/memdb.go:783 +0x87
  github.com/tikv/client-go/v2/internal/unionstore.(*MemDB).traverse()
      external/com_github_tikv_client_go_v2/internal/unionstore/memdb.go:389 +0x88
  github.com/tikv/client-go/v2/internal/unionstore.(*MemDB).Get()
      external/com_github_tikv_client_go_v2/internal/unionstore/memdb.go:209 +0x98
  github.com/pingcap/tidb/pkg/store/driver/txn.(*memBuffer).Get()
      pkg/store/driver/txn/unionstore_driver.go:60 +0x5d
  github.com/pingcap/tidb/pkg/executor.(*PointGetExecutor).get()
      pkg/executor/point_get.go:463 +0x155
  github.com/pingcap/tidb/pkg/executor.(*PointGetExecutor).getAndLock()
      pkg/executor/point_get.go:373 +0x2c4
  github.com/pingcap/tidb/pkg/executor.(*PointGetExecutor).Next()
      pkg/executor/point_get.go:310 +0xe28
  github.com/pingcap/tidb/pkg/executor/internal/exec.Next()
      pkg/executor/internal/exec/executor.go:309 +0x34b
  github.com/pingcap/tidb/pkg/executor.(*SelectLockExec).Next()
      pkg/executor/executor.go:1160 +0xe5
  github.com/pingcap/tidb/pkg/executor/internal/exec.Next()
      pkg/executor/internal/exec/executor.go:309 +0x34b
  github.com/pingcap/tidb/pkg/executor.(*UnionExec).resultPuller()
      pkg/executor/executor.go:1883 +0x989
  github.com/pingcap/tidb/pkg/executor.(*UnionExec).initialize.func1()
      pkg/executor/executor.go:1836 +0x5d
Previous write at 0x00c015035060 by goroutine 53916:
  github.com/tikv/client-go/v2/internal/unionstore.(*memdbArena).enlarge()
      external/com_github_tikv_client_go_v2/internal/unionstore/memdb_arena.go:128 +0x206
  github.com/tikv/client-go/v2/internal/unionstore.(*memdbArena).alloc()
      external/com_github_tikv_client_go_v2/internal/unionstore/memdb_arena.go:107 +0x86
  github.com/tikv/client-go/v2/internal/unionstore.(*nodeAllocator).allocNode()
      external/com_github_tikv_client_go_v2/internal/unionstore/memdb_arena.go:257 +0x8a
  github.com/tikv/client-go/v2/internal/unionstore.(*MemDB).allocNode()
      external/com_github_tikv_client_go_v2/internal/unionstore/memdb.go:789 +0xf1
  github.com/tikv/client-go/v2/internal/unionstore.(*MemDB).traverse()
      external/com_github_tikv_client_go_v2/internal/unionstore/memdb.go:410 +0x3af
  github.com/tikv/client-go/v2/internal/unionstore.(*MemDB).set()
      external/com_github_tikv_client_go_v2/internal/unionstore/memdb.go:335 +0x1cf
  github.com/tikv/client-go/v2/internal/unionstore.(*MemDB).UpdateFlags()
      external/com_github_tikv_client_go_v2/internal/unionstore/memdb.go:250 +0x2aae
  github.com/tikv/client-go/v2/txnkv/transaction.(*KVTxn).lockKeys()
      external/com_github_tikv_client_go_v2/txnkv/transaction/txn.go:1242 +0x29ed
  github.com/tikv/client-go/v2/txnkv/transaction.(*KVTxn).LockKeysFunc()
      external/com_github_tikv_client_go_v2/txnkv/transaction/txn.go:919 +0x11d
  github.com/pingcap/tidb/pkg/store/driver/txn.(*tikvTxn).LockKeysFunc()
      pkg/store/driver/txn/txn_driver.go:91 +0xb2
  github.com/pingcap/tidb/pkg/session.(*LazyTxn).LockKeysFunc()
      pkg/session/txn.go:483 +0x38d
  github.com/pingcap/tidb/pkg/session.(*LazyTxn).LockKeys()
      pkg/session/txn.go:458 +0x84
  github.com/pingcap/tidb/pkg/executor.doLockKeys()
      pkg/executor/executor.go:1279 +0x30c
  github.com/pingcap/tidb/pkg/executor.(*SelectLockExec).Next()
      pkg/executor/executor.go:1211 +0x7ae
  github.com/pingcap/tidb/pkg/executor/internal/exec.Next()
      pkg/executor/internal/exec/executor.go:309 +0x34b
  github.com/pingcap/tidb/pkg/executor.(*UnionExec).resultPuller()
      pkg/executor/executor.go:1883 +0x989
  github.com/pingcap/tidb/pkg/executor.(*UnionExec).initialize.func1()
      pkg/executor/executor.go:1836 +0x5d
Goroutine 53915 (running) created at:
  github.com/pingcap/tidb/pkg/executor.(*UnionExec).initialize()
      pkg/executor/executor.go:1836 +0x517
  github.com/pingcap/tidb/pkg/executor.(*UnionExec).Next()
      pkg/executor/executor.go:1909 +0xba
  github.com/pingcap/tidb/pkg/executor/internal/exec.Next()
      pkg/executor/internal/exec/executor.go:309 +0x34b
  github.com/pingcap/tidb/pkg/executor/aggregate.(*HashAggExec).fetchChildData()
      pkg/executor/aggregate/agg_hash_executor.go:385 +0x338
  github.com/pingcap/tidb/pkg/executor/aggregate.(*HashAggExec).prepare4ParallelExec.func3()
      pkg/executor/aggregate/agg_hash_executor.go:422 +0x5d
Goroutine 53916 (finished) created at:
  github.com/pingcap/tidb/pkg/executor.(*UnionExec).initialize()
      pkg/executor/executor.go:1836 +0x517
  github.com/pingcap/tidb/pkg/executor.(*UnionExec).Next()
      pkg/executor/executor.go:1909 +0xba
  github.com/pingcap/tidb/pkg/executor/internal/exec.Next()
      pkg/executor/internal/exec/executor.go:309 +0x34b
  github.com/pingcap/tidb/pkg/executor/aggregate.(*HashAggExec).fetchChildData()
      pkg/executor/aggregate/agg_hash_executor.go:385 +0x338
  github.com/pingcap/tidb/pkg/executor/aggregate.(*HashAggExec).prepare4ParallelExec.func3()
      pkg/executor/aggregate/agg_hash_executor.go:422 +0x5d
================== 

4. What is your TiDB version? (Required)

@hawkingrei hawkingrei added the type/bug The issue is confirmed as a bug. label Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/test severity/moderate sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

3 participants