Files
moby/daemon/debugtrap_unix.go
Derek McGowan f74e5d48b3 Create github.com/moby/moby/v2 module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:13:29 -07:00

29 lines
570 B
Go

//go:build !windows
package daemon
import (
"context"
"os"
"os/signal"
"github.com/containerd/log"
"github.com/moby/moby/v2/daemon/internal/stack"
"golang.org/x/sys/unix"
)
func (daemon *Daemon) setupDumpStackTrap(root string) {
c := make(chan os.Signal, 1)
signal.Notify(c, unix.SIGUSR1)
go func() {
for range c {
path, err := stack.DumpToFile(root)
if err != nil {
log.G(context.TODO()).WithError(err).Error("failed to write goroutines dump")
} else {
log.G(context.TODO()).Infof("goroutine stacks written to %s", path)
}
}
}()
}