summaryrefslogtreecommitdiffhomepage
path: root/runsc/container/container.go
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2020-11-05 18:16:11 -0800
committergVisor bot <gvisor-bot@google.com>2020-11-05 18:18:21 -0800
commit62b0e845b7301da7d0c75eb812e9cd75ade05b74 (patch)
tree98fef994113d5887930d94b5b0947572a8204e81 /runsc/container/container.go
parentf27edcc708e412b5c5bbeb0c274837af94c625cc (diff)
Return failure when `runsc events` queries a stopped container
This was causing gvisor-containerd-shim to crash because the command suceeded, but there was no stat present. PiperOrigin-RevId: 340964921
Diffstat (limited to 'runsc/container/container.go')
-rw-r--r--runsc/container/container.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/runsc/container/container.go b/runsc/container/container.go
index 435d866f5..4aa139c88 100644
--- a/runsc/container/container.go
+++ b/runsc/container/container.go
@@ -587,7 +587,12 @@ func (c *Container) SandboxPid() int {
// and wait returns immediately.
func (c *Container) Wait() (syscall.WaitStatus, error) {
log.Debugf("Wait on container, cid: %s", c.ID)
- return c.Sandbox.Wait(c.ID)
+ ws, err := c.Sandbox.Wait(c.ID)
+ if err == nil {
+ // Wait succeeded, container is not running anymore.
+ c.changeStatus(Stopped)
+ }
+ return ws, err
}
// WaitRootPID waits for process 'pid' in the sandbox's PID namespace and