From 80910769fd1f04ef3263915865ffec0da1d7a421 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 29 Dec 2020 11:09:46 +0100 Subject: pkg/ipc: scale sandbox timeout Scale sandbox wait timeout according to the target slowdown. Also de-hardcode program timeout. --- pkg/ipc/ipc.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'pkg/ipc') diff --git a/pkg/ipc/ipc.go b/pkg/ipc/ipc.go index 7e0bf7e94..633f639c8 100644 --- a/pkg/ipc/ipc.go +++ b/pkg/ipc/ipc.go @@ -547,13 +547,12 @@ func makeCommand(pid int, bin []string, config *Config, inFile, outFile *os.File } dir = osutil.Abs(dir) - // Executor protects against most hangs, so we use quite large timeout here. - // Executor can be slow due to global locks in namespaces and other things, - // so let's better wait than report false misleading crashes. - timeout := time.Minute - if !config.UseForkServer { - // If there is no fork server, executor does not have internal timeout. - timeout = 5 * time.Second + timeout := config.Timeouts.Program + if config.UseForkServer { + // Executor has an internal timeout and protects against most hangs when fork server is enabled, + // so we use quite large timeout. Executor can be slow due to global locks in namespaces + // and other things, so let's better wait than report false misleading crashes. + timeout *= 10 } c := &command{ @@ -697,7 +696,7 @@ func (c *command) handshake() error { read <- nil }() // Sandbox setup can take significant time. - timeout := time.NewTimer(time.Minute) + timeout := time.NewTimer(time.Minute * c.config.Timeouts.Scale) select { case err := <-read: timeout.Stop() -- cgit mrf-deployment