From 419000cc0a031e3cf5cf3a96f8f6dee5e5f7fdf5 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 29 Jul 2018 10:07:30 +0200 Subject: vm: fix "kill fuzzer on first kernel bug" The problem with that commit is that for GCE implementation we immidiately kill console connection too when receive diagnose signal. This leads to truncated output. --- vm/gce/gce.go | 49 +++++++++++++++++++++---------------------------- 1 file changed, 21 insertions(+), 28 deletions(-) (limited to 'vm/gce') diff --git a/vm/gce/gce.go b/vm/gce/gce.go index 1bdf83444..cc2cd62cd 100644 --- a/vm/gce/gce.go +++ b/vm/gce/gce.go @@ -49,17 +49,16 @@ type Pool struct { } type instance struct { - env *vmimpl.Env - cfg *Config - GCE *gce.Context - debug bool - name string - ip string - gceKey string // per-instance private ssh key associated with the instance - sshKey string // ssh key - sshUser string - closed chan bool - diagnose chan bool + env *vmimpl.Env + cfg *Config + GCE *gce.Context + debug bool + name string + ip string + gceKey string // per-instance private ssh key associated with the instance + sshKey string // ssh key + sshUser string + closed chan bool } func ctor(env *vmimpl.Env) (vmimpl.Pool, error) { @@ -172,17 +171,16 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) { } ok = true inst := &instance{ - env: pool.env, - cfg: pool.cfg, - debug: pool.env.Debug, - GCE: pool.GCE, - name: name, - ip: ip, - gceKey: gceKey, - sshKey: sshKey, - sshUser: sshUser, - closed: make(chan bool), - diagnose: make(chan bool, 1), + env: pool.env, + cfg: pool.cfg, + debug: pool.env.Debug, + GCE: pool.GCE, + name: name, + ip: ip, + gceKey: gceKey, + sshKey: sshKey, + sshUser: sshUser, + closed: make(chan bool), } return inst, nil } @@ -316,6 +314,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin } go func() { + retry: select { case <-time.After(timeout): signal(vmimpl.ErrTimeout) @@ -323,8 +322,6 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin signal(vmimpl.ErrTimeout) case <-inst.closed: signal(fmt.Errorf("instance closed")) - case <-inst.diagnose: - ssh.Process.Kill() case err := <-merger.Err: con.Process.Kill() ssh.Process.Kill() @@ -360,10 +357,6 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin } func (inst *instance) Diagnose() bool { - select { - case inst.diagnose <- true: - default: - } return false } -- cgit mrf-deployment