summaryrefslogtreecommitdiffhomepage
path: root/pkg/control/server/server.go
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@gmail.com>2021-06-22 10:47:37 -0700
committerAndrei Vagin <avagin@gmail.com>2021-06-22 11:01:31 -0700
commitd703340bc04a4269f420fdf24d946abcbc6a620b (patch)
tree1fbcb33795a009c56a16823611cf471d733c4aa5 /pkg/control/server/server.go
parentbc27a991851fdffa59f028eecfc22bdd17ccaa55 (diff)
runsc: don't kill sandbox, let it stop properly
The typical sequence of calls to start a container looks like this ct, err := container.New(conf, containerArgs) defer ct.Destroy() ct.Start(conf) ws, err := ct.Wait() For the root container, ct.Destroy() kills the sandbox process. This doesn't look like a right wait to stop it. For example, all ongoing rpc calls are aborted in this case. If everything is going alright, we can just wait and it will exit itself. Reported-by: syzbot+084fca334720887441e7@syzkaller.appspotmail.com Signed-off-by: Andrei Vagin <avagin@gmail.com>
Diffstat (limited to 'pkg/control/server/server.go')
-rw-r--r--pkg/control/server/server.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/control/server/server.go b/pkg/control/server/server.go
index 629dae8f4..eca06791c 100644
--- a/pkg/control/server/server.go
+++ b/pkg/control/server/server.go
@@ -21,6 +21,7 @@ implementations of the control interface.
package server
import (
+ "context"
"os"
"gvisor.dev/gvisor/pkg/log"
@@ -65,13 +66,13 @@ func (s *Server) Wait() {
// Stop stops the server. Note that this function should only be called once
// and the server should not be used afterwards.
-func (s *Server) Stop() {
+func (s *Server) Stop(ctx context.Context) {
s.socket.Close()
s.Wait()
// This will cause existing clients to be terminated safely. If the
// registered handlers have a Stop callback, it will be called.
- s.server.Stop()
+ s.server.Stop(ctx)
}
// StartServing starts listening for connect and spawns the main service