summaryrefslogtreecommitdiffhomepage
path: root/runsc/container/container.go
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2018-11-15 15:34:38 -0800
committerShentubot <shentubot@google.com>2018-11-15 15:35:41 -0800
commitadf8138e069a99aa7f3fe190a9a7c17a4e88b99a (patch)
tree349dd842162121546b957702aa8abebdfc82cc7b /runsc/container/container.go
parentf7aa9371247a3e7d8c490ac0fd4c4f3ff6de2017 (diff)
Allow sandbox.Wait to be called after the sandbox has exited.
sandbox.Wait is racey, as the sandbox may have exited before it is called, or even during. We already had code to handle the case that the sandbox exits during the Wait call, but we were not properly handling the case where the sandbox has exited before the call. The best we can do in such cases is return the sandbox exit code as the application exit code. PiperOrigin-RevId: 221702517 Change-Id: I290d0333cc094c7c1c3b4ce0f17f61a3e908d787
Diffstat (limited to 'runsc/container/container.go')
-rw-r--r--runsc/container/container.go3
1 files changed, 0 insertions, 3 deletions
diff --git a/runsc/container/container.go b/runsc/container/container.go
index 11c440f09..80a27df4a 100644
--- a/runsc/container/container.go
+++ b/runsc/container/container.go
@@ -476,9 +476,6 @@ func (c *Container) SandboxPid() int {
// and wait returns immediately.
func (c *Container) Wait() (syscall.WaitStatus, error) {
log.Debugf("Wait on container %q", c.ID)
- if !c.isSandboxRunning() {
- return 0, fmt.Errorf("sandbox is not running")
- }
return c.Sandbox.Wait(c.ID)
}