github.com/jiasir/docker@v1.3.3-0.20170609024000-252e610103e7/daemon/debugtrap_unix.go (about) 1 // +build !windows 2 3 package daemon 4 5 import ( 6 "os" 7 "os/signal" 8 "syscall" 9 10 "github.com/Sirupsen/logrus" 11 stackdump "github.com/docker/docker/pkg/signal" 12 ) 13 14 func (d *Daemon) setupDumpStackTrap(root string) { 15 c := make(chan os.Signal, 1) 16 signal.Notify(c, syscall.SIGUSR1) 17 go func() { 18 for range c { 19 path, err := stackdump.DumpStacks(root) 20 if err != nil { 21 logrus.WithError(err).Error("failed to write goroutines dump") 22 } else { 23 logrus.Infof("goroutine stacks written to %s", path) 24 } 25 } 26 }() 27 }