Files
moby/daemon/debugtrap_unix.go
Sebastiaan van Stijn 76e2ca1d41 pkg/stack: move to daemon/internal
This package is used by the daemon to produce a stack-dump, It has no
external consumers, so we can move it to daemon/internal.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 18:39:22 +02:00

29 lines
571 B
Go

//go:build !windows
package daemon
import (
"context"
"os"
"os/signal"
"github.com/containerd/log"
"github.com/docker/docker/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)
}
}
}()
}