pingcap / tidb

TiDB - the open-source, cloud-native, distributed SQL database designed for modern applications.
https://pingcap.com
Apache License 2.0
37.2k stars 5.84k forks source link

TiDB v5.3.1 - panic while running TPCC #34307

Closed tiancaiamao closed 2 years ago

tiancaiamao commented 2 years ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

[2022/04/27 13:56:31.773 +05:30] [WARN] [lock_resolver.go:498] ["lock txn not found, lock has expired"] [CallerStartTs=0] ["lock str"="key: 7480000000000002255f698000000000000001038000000000000001038000000000000005038000000000000a5b, primary: 7480000000000002195f72800000000005fc9f, txnStartTS: 432812294371279123, lockForUpdateTS:432812310610837546, minCommitTs:432812310610837547, ttl: 81949, type: PessimisticLock, UseAsyncCommit: false, txnSize: 0"]
[2022/04/27 13:56:31.868 +05:30] [WARN] [lock_resolver.go:498] ["lock txn not found, lock has expired"] [CallerStartTs=0] ["lock str"="key: 74800000000000022d5f698000000000000001038000000000000027038000000000000008038000000000000a80, primary: 7480000000000002215f728000000000049d34, txnStartTS: 432812294672482366, lockForUpdateTS:432812311279566986, minCommitTs:432812311279566987, ttl: 83358, type: PessimisticLock, UseAsyncCommit: false, txnSize: 0"]
[2022/04/27 13:56:31.959 +05:30] [WARN] [lock_resolver.go:498] ["lock txn not found, lock has expired"] [CallerStartTs=0] ["lock str"="key: 7480000000000002195f728000000000047c3f, primary: 7480000000000002195f72800000000005fc9f, txnStartTS: 432812309116616799, lockForUpdateTS:432812319287803958, minCommitTs:432812319287803959, ttl: 58820, type: PessimisticLock, UseAsyncCommit: false, txnSize: 0"]
[2022/04/27 13:56:31.971 +05:30] [WARN] [lock_resolver.go:498] ["lock txn not found, lock has expired"] [CallerStartTs=0] ["lock str"="key: 74800000000000021c5f698000000000000001038000000000000022038000000000000005038000000000000a54, primary: 74800000000000021c5f72800000000003c7c0, txnStartTS: 432812310728802398, lockForUpdateTS:432812318396514373, minCommitTs:432812318396514374, ttl: 49247, type: PessimisticLock, UseAsyncCommit: false, txnSize: 0"]
[2022/04/27 13:56:32.078 +05:30] [WARN] [lock_resolver.go:498] ["lock txn not found, lock has expired"] [CallerStartTs=0] ["lock str"="key: 7480000000000002255f69800000000000000103800000000000000b038000000000000005038000000000000a89, primary: 7480000000000002195f7280000000000108d5, txnStartTS: 432812312131534911, lockForUpdateTS:432812312288559114, minCommitTs:432812312288559115, ttl: 20581, type: PessimisticLock, UseAsyncCommit: false, txnSize: 0"]
[2022/04/27 13:56:32.132 +05:30] [WARN] [lock_resolver.go:498] ["lock txn not found, lock has expired"] [CallerStartTs=0] ["lock str"="key: 7480000000000002195f728000000000016569, primary: 7480000000000002195f7280000000000108d5, txnStartTS: 432812312682037297, lockForUpdateTS:432812319327125637, minCommitTs:432812319327125638, ttl: 45389, type: PessimisticLock, UseAsyncCommit: false, txnSize: 0"]
panic: runtime error: index out of range [4294967295] with length 4096

goroutine 631996 [running]:
github.com/tikv/client-go/v2/internal/unionstore.(*nodeAllocator).getNode(...)
    /home/genius/project/src/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/internal/unionstore/memdb_arena.go:213
github.com/tikv/client-go/v2/internal/unionstore.(*MemDB).getNode(...)
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/internal/unionstore/memdb.go:754
github.com/tikv/client-go/v2/internal/unionstore.memdbNodeAddr.getRight(...)
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/internal/unionstore/memdb.go:786
github.com/tikv/client-go/v2/internal/unionstore.(*MemDB).traverse(0xc016f4a410, 0xc0083e6720, 0x13, 0x13, 0x0, 0x60, 0x7f53366435b8)
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/internal/unionstore/memdb.go:375 +0xd4c
github.com/tikv/client-go/v2/internal/unionstore.(*MemDB).GetFlags(0xc016f4a410, 0xc0083e6720, 0x13, 0x13, 0x3b82540, 0x4266e01, 0xc002acde00)
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/internal/unionstore/memdb.go:223 +0x52
github.com/tikv/client-go/v2/internal/unionstore.(*KVUnionStore).HasPresumeKeyNotExists(0xc0110963d8, 0xc0083e6720, 0x13, 0x13, 0x13)
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/internal/unionstore/union_store.go:141 +0x4c
github.com/tikv/client-go/v2/txnkv/transaction.actionPessimisticLock.handleSingleBatch(0xc011d897a0, 0xc012b38180, 0xc00f66afc0, 0x32a3, 0x1d, 0x489, 0x42d9558, 0xc019aa3d40, 0x0, 0x12f0a05, ...)
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/txnkv/transaction/pessimistic.go:94 +0x1c7
github.com/tikv/client-go/v2/txnkv/transaction.(*batchExecutor).startWorker.func1(0xc00c949a00, 0xc019aa3ec0, 0x32a3, 0x1d, 0x489, 0x42d9558, 0xc019aa3d40, 0x0)
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/txnkv/transaction/2pc.go:1791 +0x197
created by github.com/tikv/client-go/v2/txnkv/transaction.(*batchExecutor).startWorker
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/txnkv/transaction/2pc.go:1774 +0x19e
panic: runtime error: index out of range [4294967295] with length 4096

goroutine 631997 [running]:
github.com/tikv/client-go/v2/internal/unionstore.(*nodeAllocator).getNode(...)
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/internal/unionstore/memdb_arena.go:213
github.com/tikv/client-go/v2/internal/unionstore.(*MemDB).getNode(...)
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/internal/unionstore/memdb.go:754
github.com/tikv/client-go/v2/internal/unionstore.memdbNodeAddr.getRight(...)
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/internal/unionstore/memdb.go:786
github.com/tikv/client-go/v2/internal/unionstore.(*MemDB).traverse(0xc016f4a410, 0xc0083e6300, 0x13, 0x13, 0x0, 0x60, 0x7f5336643a68)
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/internal/unionstore/memdb.go:375 +0xd4c
github.com/tikv/client-go/v2/internal/unionstore.(*MemDB).GetFlags(0xc016f4a410, 0xc0083e6300, 0x13, 0x13, 0x3b82540, 0x4266e01, 0xc018266900)
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/internal/unionstore/memdb.go:223 +0x52
github.com/tikv/client-go/v2/internal/unionstore.(*KVUnionStore).HasPresumeKeyNotExists(0xc0110963d8, 0xc0083e6300, 0x13, 0x13, 0x13)
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/internal/unionstore/union_store.go:141 +0x4c
github.com/tikv/client-go/v2/txnkv/transaction.actionPessimisticLock.handleSingleBatch(0xc011d897a0, 0xc012b38180, 0xc011d898c0, 0x2f4c, 0x1d, 0x489, 0x42d9558, 0xc019aa3da0, 0x0, 0x339ea69, ...)
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/txnkv/transaction/pessimistic.go:94 +0x1c7
github.com/tikv/client-go/v2/txnkv/transaction.(*batchExecutor).startWorker.func1(0xc00c949a00, 0xc019aa3ec0, 0x2f4c, 0x1d, 0x489, 0x42d9558, 0xc019aa3da0, 0x0)
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/txnkv/transaction/2pc.go:1791 +0x197
created by github.com/tikv/client-go/v2/txnkv/transaction.(*batchExecutor).startWorker
    /nfs/cache/mod/github.com/tikv/client-go/v2@v2.0.0-alpha.0.20211029104011-2fd3841894de/txnkv/transaction/2pc.go:1774 +0x19e

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

No panic log

3. What did you see instead (Required)

panic found in the log

4. What is your TiDB version? (Required)

v5.3.1

tiancaiamao commented 2 years ago

Ref https://github.com/tikv/client-go/pull/482

tiancaiamao commented 2 years ago

Seems duplicated with https://github.com/pingcap/tidb/issues/26832