pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
36.89k stars 5.81k forks source link

goleak in the com_github_tikv_client_go_v2/config/retry/backoff.go:122 #55489

Open hawkingrei opened 4 weeks ago

hawkingrei commented 4 weeks ago

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)

goleak: Errors on successful test run: found unexpected goroutines:
[Goroutine 712329 in state semacquire, with sync.runtime_Semacquire on top of the stack:
sync.runtime_Semacquire(0xc000fbf350?)
    GOROOT/src/runtime/sema.go:62 +0x25
sync.(*WaitGroup).Wait(0xc062792cc0?)
    GOROOT/src/sync/waitgroup.go:116 +0x48
github.com/pingcap/tidb/pkg/store/copr.(*copIteratorTaskSender).run(0xc0627896d0, 0x8)
    pkg/store/copr/coprocessor.go:914 +0x24b
created by github.com/pingcap/tidb/pkg/store/copr.(*copIterator).open in goroutine 701406
    pkg/store/copr/coprocessor.go:881 +0x518
 Goroutine 712328 in state select, with github.com/tikv/client-go/v2/config/retry.(*Config).createBackoffFn.newBackoffFn.func2 on top of the stack:
github.com/tikv/client-go/v2/config/retry.(*Config).createBackoffFn.newBackoffFn.func2({0x3528c90, 0xc0627a6480}, 0xffffffffffffffff)
    external/com_github_tikv_client_go_v2/config/retry/config.go:205 +0x505
github.com/tikv/client-go/v2/config/retry.(*Backoffer).BackoffWithCfgAndMaxSleep(0xc0626c6870, 0xc001768270, 0x24781a0?, {0x34f5680, 0xc0626de3d8})
    external/com_github_tikv_client_go_v2/config/retry/backoff.go:195 +0x66d
github.com/tikv/client-go/v2/config/retry.(*Backoffer).Backoff(0xc0626c6870, 0xc001768270, {0x34f5680, 0xc0626de3d8})
    external/com_github_tikv_client_go_v2/config/retry/backoff.go:122 +0x251
github.com/tikv/client-go/v2/internal/locate.(*replicaSelector).onServerIsBusy(0xc0626c6900, 0xc062689c00?, 0xc0626c4480?, 0x297741d?, 0xe?)
    external/com_github_tikv_client_go_v2/internal/locate/replica_selector.go:534 +0x2cf
github.com/tikv/client-go/v2/internal/locate.(*RegionRequestSender).onRegionError(0xc0626a36c0, 0xc0626c6870, 0xc0626c4480, 0xc062689c00, 0xc0626ae820)
    external/com_github_tikv_client_go_v2/internal/locate/region_request.go:1598 +0x994
github.com/tikv/client-go/v2/internal/locate.(*RegionRequestSender).SendReqCtx(0xc0626a36c0, 0xc0626c6870, 0xc062689c00, {0x2, 0x1, 0x1}, 0xdf8475800, 0x0, {0xc0626cfb88, 0x0, ...})
    external/com_github_tikv_client_go_v2/internal/locate/region_request.go:907 +0x169d
github.com/tikv/client-go/v2/txnkv/txnsnapshot.(*ClientHelper).SendReqCtx(0xc062671ec0, 0x11a00000000?, 0xc062689c00, {0x11800000000?, 0x11700000000?, 0x11600000000?}, 0x11500000000?, 0x0?, {0x0, 0x0}, ...)
    external/com_github_tikv_client_go_v2/txnkv/txnsnapshot/client_helper.go:146 +0x245
github.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).handleTaskOnce(0xc0627950a0, 0xc056840388, 0xc061aa9a40, 0xc061aa9a40?)
    pkg/store/copr/coprocessor.go:1265 +0xc3d
github.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).handleTask(0xc0627950a0, {0x3528c90, 0xc0627a6480}, 0x6800000000?, 0xc06267cea0)
    pkg/store/copr/coprocessor.go:1155 +0x18e
github.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).run(0xc0627950a0, {0x3528c90, 0xc0627a6480})
    pkg/store/copr/coprocessor.go:816 +0x116
created by github.com/pingcap/tidb/pkg/store/copr.(*copIterator).open in goroutine 701406
    pkg/store/copr/coprocessor.go:863 +0xe5
] 

4. What is your TiDB version? (Required)

hawkingrei commented 4 weeks ago

https://tiprow.hawkingrei.com/view/gs/pingcapprow/pr-logs/pull/pingcap_tidb/55447/fast_test_tiprow/1825385641907589120#1:build-log.txt%3A6972