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

goleak: Errors on successful test run: found unexpected goroutines #31094

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)

make failpoint-enable;
cd session;
go test -test.run '^TestT$' -check.f testPessimisticSuite.TestKillStopTTLManager

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

Success, no error

3. What did you see instead (Required)

Unexpected output, some goroutine are found leak:

[2021/12/28 19:04:32.696 +08:00] [INFO] [db.go:596] ["Compaction finished"]
[2021/12/28 19:04:32.696 +08:00] [INFO] [db.go:615] ["BlobManager finished"]
[2021/12/28 19:04:32.696 +08:00] [INFO] [db.go:619] ["ResourceManager finished"]
[2021/12/28 19:04:32.696 +08:00] [INFO] [db.go:625] ["Waiting for closer"]
OK: 1 passed
PASS
[2021/12/28 19:04:32.838 +08:00] [INFO] [2pc.go:961] ["send TxnHeartBeat"] [startTS=430096900774166528] [newTTL=1801]
[2021/12/28 19:04:32.988 +08:00] [INFO] [2pc.go:961] ["send TxnHeartBeat"] [startTS=430096900774166528] [newTTL=1951]
[2021/12/28 19:04:33.139 +08:00] [INFO] [2pc.go:961] ["send TxnHeartBeat"] [startTS=430096900774166528] [newTTL=2102]
[2021/12/28 19:04:33.288 +08:00] [INFO] [2pc.go:961] ["send TxnHeartBeat"] [startTS=430096900774166528] [newTTL=2251]
[2021/12/28 19:04:33.438 +08:00] [INFO] [2pc.go:961] ["send TxnHeartBeat"] [startTS=430096900774166528] [newTTL=2401]
[2021/12/28 19:04:33.588 +08:00] [INFO] [2pc.go:961] ["send TxnHeartBeat"] [startTS=430096900774166528] [newTTL=2551]
[2021/12/28 19:04:33.738 +08:00] [INFO] [2pc.go:961] ["send TxnHeartBeat"] [startTS=430096900774166528] [newTTL=2701]
[2021/12/28 19:04:33.888 +08:00] [INFO] [2pc.go:961] ["send TxnHeartBeat"] [startTS=430096900774166528] [newTTL=2851]
[2021/12/28 19:04:34.038 +08:00] [INFO] [2pc.go:961] ["send TxnHeartBeat"] [startTS=430096900774166528] [newTTL=3000]
goleak: Errors on successful test run: found unexpected goroutines:
[Goroutine 629 in state select, with github.com/tikv/client-go/v2/txnkv/transaction.keepAlive on top of the stack:
goroutine 629 [select]:
github.com/tikv/client-go/v2/txnkv/transaction.keepAlive(0xc00565fc80, 0xc00698e3c0, 0xc0004e6de0, 0x13, 0x13, 0xc00669dcc0)
        /home/genius/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.0-rc.0.20211223062159-300275dee63e/txnkv/transaction/2pc.go:927 +0x105
created by github.com/tikv/client-go/v2/txnkv/transaction.(*ttlManager).run
        /home/genius/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.0-rc.0.20211223062159-300275dee63e/txnkv/transaction/2pc.go:900 +0xfe
]
exit status 1
FAIL    github.com/pingcap/tidb/session 3.435s

4. What is your TiDB version? (Required)

master

github-actions[bot] commented 2 years ago

Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label.