From 4ad7315b6759afa81f492ec119080deb9a224101 Mon Sep 17 00:00:00 2001 From: Fabricio Voznika Date: Wed, 20 Jun 2018 13:30:39 -0700 Subject: Add 'runsc debug' command It prints sandbox stacks to the log to help debug stuckness. I expect that many more options will be added in the future. PiperOrigin-RevId: 201405931 Change-Id: I87e560800cd5a5a7b210dc25a5661363c8c3a16e --- runsc/sandbox/sandbox.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'runsc/sandbox') diff --git a/runsc/sandbox/sandbox.go b/runsc/sandbox/sandbox.go index 90b46e247..652910efa 100644 --- a/runsc/sandbox/sandbox.go +++ b/runsc/sandbox/sandbox.go @@ -537,6 +537,22 @@ func (s *Sandbox) IsRunning() bool { return false } +// Stacks collects and returns all stacks for the sandbox. +func (s *Sandbox) Stacks() (string, error) { + log.Debugf("Stacks sandbox %q", s.ID) + conn, err := s.connect() + if err != nil { + return "", err + } + defer conn.Close() + + var stacks string + if err := conn.Call(boot.SandboxStacks, nil, &stacks); err != nil { + return "", fmt.Errorf("err getting sandbox %q stacks: %v", s.ID, err) + } + return stacks, nil +} + // killProcess sends a signal to the host process (i.e. a sandbox or gofer // process). Sandbox.Signal should be used to send a signal to a process // running inside the sandbox. -- cgit v1.2.3