From d87ae1c44494700f681d7d50efec8d5500716c33 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 9 Sep 2016 13:22:48 +0200 Subject: manager: fix deadlock This fixes 2 problems: 1. syz-manager inverted condition for local instances. 2. local instances deadlocked on "no output" condition --- syz-manager/manager.go | 2 +- 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) diff --git a/vm/vm.go b/vm/vm.go index 25d5010da..ac60c8de0 100644 --- a/vm/vm.go +++ b/vm/vm.go @@ -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 } -- cgit mrf-deployment