mirror of
https://github.com/hanzoai/visor.git
synced 2026-09-24 17:04:14 +00:00
Improvements to stuck task tool
Use function names as line ID (path+line may include registers that make it non-unique). Sort larger stacks at the top. This is useful to spot unique stacks that are likely the ones causing the deadlock. PiperOrigin-RevId: 810562912
This commit is contained in:
committed by
gVisor bot
parent
baacd340c6
commit
efc1bd1884
@@ -8,7 +8,5 @@ package(
|
||||
go_binary(
|
||||
name = "stucktasks",
|
||||
srcs = ["stucktasks.go"],
|
||||
deps = [
|
||||
"//runsc/flag",
|
||||
],
|
||||
deps = ["//runsc/flag"],
|
||||
)
|
||||
|
||||
@@ -134,7 +134,11 @@ func analyzeStackDump(scanner *bufio.Scanner, out io.Writer, stuckIds map[uint]s
|
||||
sorted = append(sorted, c)
|
||||
}
|
||||
sort.Slice(sorted, func(i, j int) bool {
|
||||
// Reverse sort
|
||||
// Sort with the most occurring stacks first, then start with the longest stacks (likely
|
||||
// to be the more relevant for deadlocks).
|
||||
if sorted[i].count == sorted[j].count {
|
||||
return len(sorted[i].stack.lines) > len(sorted[j].stack.lines)
|
||||
}
|
||||
return sorted[i].count > sorted[j].count
|
||||
})
|
||||
|
||||
@@ -210,7 +214,13 @@ func parseBlock(block []string) (*stack, error) {
|
||||
|
||||
var signature string
|
||||
for i, line := range block[1:] {
|
||||
if i%2 == 1 {
|
||||
// Only look at function names. Skip odd lines that contain file names.
|
||||
if i%2 == 0 {
|
||||
// Use the full function name, but ignore argument values.
|
||||
idx := strings.LastIndex(line, "(")
|
||||
if idx != -1 {
|
||||
line = line[:idx]
|
||||
}
|
||||
signature += line + "\n"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user