diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-12-29 11:09:46 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-12-29 13:56:59 +0100 |
| commit | 80910769fd1f04ef3263915865ffec0da1d7a421 (patch) | |
| tree | 80a274bd1c43715d2c0c4eac2a62842ef1e3ae61 /pkg | |
| parent | 27a9e3872eb3a229cced88c14a2011188fa968df (diff) | |
pkg/ipc: scale sandbox timeout
Scale sandbox wait timeout according to the target slowdown.
Also de-hardcode program timeout.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/ipc/ipc.go | 15 |
1 files changed, 7 insertions, 8 deletions
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() |
