-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add core state lock deadlock detection config option v2 (#18604)
* add core state lockd eadlock detection config option v2 * add changelog * split out NewTestCluster function to maintain build flag * replace long func with constant * remove line * rename file, and move where detect deadlock flag is set
- Loading branch information
1 parent
72e77e9
commit 06e83f3
Showing
14 changed files
with
131 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:improvement | ||
core: add `detect_deadlocks` config to optionally detect core state deadlocks | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,46 @@ | ||
//go:build !deadlock | ||
|
||
package locking | ||
|
||
import ( | ||
"sync" | ||
|
||
"github.com/sasha-s/go-deadlock" | ||
) | ||
|
||
// DeadlockMutex is just a sync.Mutex when the build tag `deadlock` is absent. | ||
// See its other definition in the corresponding deadlock-build-tag-constrained | ||
// file for more details. | ||
// Common mutex interface to allow either built-in or imported deadlock use | ||
type Mutex interface { | ||
Lock() | ||
Unlock() | ||
} | ||
|
||
// Common r/w mutex interface to allow either built-in or imported deadlock use | ||
type RWMutex interface { | ||
Lock() | ||
RLock() | ||
RLocker() sync.Locker | ||
RUnlock() | ||
Unlock() | ||
} | ||
|
||
// DeadlockMutex (used when requested via config option `detact_deadlocks`), | ||
// behaves like a sync.Mutex but does periodic checking to see if outstanding | ||
// locks and requests look like a deadlock. If it finds a deadlock candidate it | ||
// will output it prefixed with "POTENTIAL DEADLOCK", as described at | ||
// https://github.com/sasha-s/go-deadlock | ||
type DeadlockMutex struct { | ||
sync.Mutex | ||
deadlock.Mutex | ||
} | ||
|
||
// DeadlockRWMutex is the RW version of DeadlockMutex. | ||
type DeadlockRWMutex struct { | ||
deadlock.RWMutex | ||
} | ||
|
||
// Regular sync/mutex. | ||
type SyncMutex struct { | ||
sync.Mutex | ||
} | ||
|
||
// DeadlockRWMutex is the RW version of SyncMutex. | ||
type SyncRWMutex struct { | ||
sync.RWMutex | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//go:build deadlock | ||
|
||
package vault | ||
|
||
const TestDeadlockDetection = "statelock" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//go:build !deadlock | ||
|
||
package vault | ||
|
||
const TestDeadlockDetection = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters