github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/daemon/debugtrap_unix.go (about) 1 //go:build !windows 2 // +build !windows 3 4 package daemon // import "github.com/docker/docker/daemon" 5 6 import ( 7 "os" 8 "os/signal" 9 10 "github.com/docker/docker/pkg/stack" 11 "github.com/sirupsen/logrus" 12 "golang.org/x/sys/unix" 13 ) 14 15 func (daemon *Daemon) setupDumpStackTrap(root string) { 16 c := make(chan os.Signal, 1) 17 signal.Notify(c, unix.SIGUSR1) 18 go func() { 19 for range c { 20 path, err := stack.DumpToFile(root) 21 if err != nil { 22 logrus.WithError(err).Error("failed to write goroutines dump") 23 } else { 24 logrus.Infof("goroutine stacks written to %s", path) 25 } 26 } 27 }() 28 }