Add SIGUSR1 to print the stack of containerd
Signed-off-by: Lei Jitang <leijitang@huawei.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
@@ -436,3 +437,18 @@ func interceptor(ctx gocontext.Context,
|
||||
}
|
||||
return grpc_prometheus.UnaryServerInterceptor(ctx, req, info, handler)
|
||||
}
|
||||
|
||||
func dumpStacks() {
|
||||
var (
|
||||
buf []byte
|
||||
stackSize int
|
||||
)
|
||||
bufferLen := 16384
|
||||
for stackSize == len(buf) {
|
||||
buf = make([]byte, bufferLen)
|
||||
stackSize = runtime.Stack(buf, true)
|
||||
bufferLen *= 2
|
||||
}
|
||||
buf = buf[:stackSize]
|
||||
logrus.Infof("=== BEGIN goroutine stack dump ===\n%s\n=== END goroutine stack dump ===", buf)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user