tikv / tikv/pd

deadlock detect may be wrong.

Open
#4,641 2 comments 0 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Go
Stars
1.2k
Forks
783
Avg merge
5d 21h
Merged PRs (30d)
36

Description

## Enhancement Task
using go-deadlock to delect dead lock may be wring, like [this](https://go.dev/play/p/uCVKTjYo63R):
```
package main

import (
"time"

"github.com/sasha-s/go-deadlock"
)

func main() {
var cond1 deadlock.RWMutex
var cond2 deadlock.RWMutex
// it will be ok if DisableLockOrderDetection=true
//deadlock.Opts.DisableLockOrderDetection = true
cond1.Lock()
cond2.RLock()
cond2.RUnlock()
cond1.Unlock()
go func() {
cond2.RLock()
cond1.RLock()
cond1.RUnlock()
cond2.RUnlock()
}()
time.Sleep(time.Second)
}
```
the mainly reason is that this lib records all locks by using one map and this map will reset if it's capacity is not available.
In past, some unit case will be failed if there are some healthy regions in cluster, like [this](https://github.com/bufferflies/pd/pull/5):

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.