diff options
author | Fabricio Voznika <fvoznika@google.com> | 2018-06-20 13:30:39 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-06-20 13:31:31 -0700 |
commit | 4ad7315b6759afa81f492ec119080deb9a224101 (patch) | |
tree | 0f1e4c51b199301023f0269855013e020cc54ea2 /runsc/sandbox | |
parent | 5aa7615ec93335a922361728881ab1224a6e9266 (diff) |
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
Diffstat (limited to 'runsc/sandbox')
-rw-r--r-- | runsc/sandbox/sandbox.go | 16 |
1 files changed, 16 insertions, 0 deletions
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. |