summaryrefslogtreecommitdiffhomepage
path: root/runsc
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-06-25 22:47:11 +0000
committergVisor bot <gvisor-bot@google.com>2021-06-25 22:47:11 +0000
commit17e7bcb5b604f278a3280b7e23c4971f3dcd02a4 (patch)
tree9a107e55f7fae52006886146739b6ae9d4f1c6da /runsc
parent5385b6be1e80d14746766df036a20d55d91a0bb8 (diff)
parente5526f4f2696a2334d61b05f31ad23b7bee4342b (diff)
Merge release-20210614.0-34-ge5526f4f2 (automated)
Diffstat (limited to 'runsc')
-rw-r--r--runsc/boot/controller.go6
-rw-r--r--runsc/sandbox/sandbox.go6
2 files changed, 11 insertions, 1 deletions
diff --git a/runsc/boot/controller.go b/runsc/boot/controller.go
index d52cf5a00..34f939953 100644
--- a/runsc/boot/controller.go
+++ b/runsc/boot/controller.go
@@ -18,6 +18,7 @@ import (
"errors"
"fmt"
"os"
+ gtime "time"
specs "github.com/opencontainers/runtime-spec/specs-go"
"golang.org/x/sys/unix"
@@ -165,8 +166,11 @@ func newController(fd int, l *Loader) (*controller, error) {
return ctrl, nil
}
+// stopRPCTimeout is the time for clients to complete ongoing RPCs.
+const stopRPCTimeout = 15 * gtime.Second
+
func (c *controller) stop() {
- c.srv.Stop()
+ c.srv.Stop(stopRPCTimeout)
}
// containerManager manages sandbox containers.
diff --git a/runsc/sandbox/sandbox.go b/runsc/sandbox/sandbox.go
index 29e202b7d..f14cc7229 100644
--- a/runsc/sandbox/sandbox.go
+++ b/runsc/sandbox/sandbox.go
@@ -797,7 +797,13 @@ func (s *Sandbox) Wait(cid string) (unix.WaitStatus, error) {
// Try the Wait RPC to the sandbox.
var ws unix.WaitStatus
err = conn.Call(boot.ContainerWait, &cid, &ws)
+ conn.Close()
if err == nil {
+ if s.IsRootContainer(cid) {
+ if err := s.waitForStopped(); err != nil {
+ return unix.WaitStatus(0), err
+ }
+ }
// It worked!
return ws, nil
}