diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2016-09-09 13:22:48 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2016-09-09 13:22:48 +0200 |
| commit | d87ae1c44494700f681d7d50efec8d5500716c33 (patch) | |
| tree | e3c520fdcac6f7c1f87fef64f73b77fb132cc827 | |
| parent | 824b2687cfab5f95ab29f84474811a84d6442644 (diff) | |
manager: fix deadlock
This fixes 2 problems:
1. syz-manager inverted condition for local instances.
2. local instances deadlocked on "no output" condition
| -rw-r--r-- | syz-manager/manager.go | 2 | ||||
| -rw-r--r-- | vm/vm.go | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/syz-manager/manager.go b/syz-manager/manager.go index dbdbdeadd..18ca57928 100644 --- a/syz-manager/manager.go +++ b/syz-manager/manager.go @@ -260,7 +260,7 @@ func (mgr *Manager) runInstance(vmCfg *vm.Config, first bool) bool { return false } - desc, text, output, crashed, timedout := vm.MonitorExecution(outc, errc, mgr.cfg.Type != "local", true) + desc, text, output, crashed, timedout := vm.MonitorExecution(outc, errc, mgr.cfg.Type == "local", true) if timedout { // This is the only "OK" outcome. logf(0, "%v: running long enough, restarting", vmCfg.Name) @@ -107,10 +107,12 @@ func MonitorExecution(outc <-chan []byte, errc <-chan error, local, needOutput b ) lastExecuteTime := time.Now() ticker := time.NewTimer(3 * time.Minute) + tickerFired := false for { - if !ticker.Stop() { + if !tickerFired && !ticker.Stop() { <-ticker.C } + tickerFired = false ticker.Reset(3 * time.Minute) select { case err := <-errc: @@ -160,6 +162,7 @@ func MonitorExecution(outc <-chan []byte, errc <-chan error, local, needOutput b return "test machine is not executing programs", nil, output, true, false } case <-ticker.C: + tickerFired = true if !local { return "no output from test machine", nil, output, true, false } |
