Lock and unlock in `AcquireDistributedLock` can be stuck by internal RPC
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
In function `AcquireDistributedLock` of `pkg/owner/manager.go`, lock and unlock operation use a context without timeout. Therefore, the RPCs in these two operations have no deadline, which means that once the RPC like `Txn` stuck, these operations will be blocked endlessly.
https://github.com/pingcap/tidb/blob/master/pkg/owner/manager.go#L638
https://github.com/pingcap/tidb/blob/master/pkg/owner/manager.go#L656
### 1. Minimal reproduce step (Required)
Any query triggers `AcquireDistributedLock`.
### 2. What did you expect to see? (Required)
Lock and unlock operations return `DeadlineExceeded`, not blocked endlessly.
### 3. What did you see instead (Required)
Lock and unlock operations are blocked by internal RPCs, further block `AcquireDistributedLock`.
### 4. What is your TiDB version? (Required)
master
Contributor guide
Assessment
This issue has not been assessed yet.