mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-04 15:58:39 +00:00
Add SIGUSR1 handler for dumping stack/goroutine traces
Add handler for SIGUSR1 based on feedback regarding when to dump goroutine stacks. This will also dump goroutine stack traces on SIGQUIT followed by a hard-exit from the daemon. Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
This commit is contained in:
@@ -747,6 +747,9 @@ func NewDaemon(config *Config, registryService *registry.Service) (daemon *Daemo
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// set up SIGUSR1 handler to dump Go routine stacks
|
||||
setupSigusr1Trap()
|
||||
|
||||
// set up the tmpDir to use a canonical path
|
||||
tmp, err := tempDir(config.Root)
|
||||
if err != nil {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// +build !windows
|
||||
|
||||
package daemon
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
psignal "github.com/docker/docker/pkg/signal"
|
||||
)
|
||||
|
||||
func setupSigusr1Trap() {
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGUSR1)
|
||||
go func() {
|
||||
for range c {
|
||||
psignal.DumpStacks()
|
||||
}
|
||||
}()
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// +build !linux,!darwin,!freebsd
|
||||
|
||||
package signal
|
||||
|
||||
func setupSigusr1Trap() {
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user