Skip to content

Commit

Permalink
vm/vmimpl: don't wait commands that have not failed
Browse files Browse the repository at this point in the history
The sleep in Multiplex is unconditional and it sleeps idle
even for commands that has nothting to do with executor,
and for executor in other modes that has nothing to do with fuzzing.
Since the original reason for the sleep was related to failing executor,
sleep only when the command fails. This allows to at least run
successful commands fast.
  • Loading branch information
dvyukov committed Jul 11, 2024
1 parent b04e57f commit eaeb5c1
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions vm/vmimpl/vmimpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,21 +191,23 @@ func Multiplex(cmd *exec.Cmd, merger *OutputMerger, timeout time.Duration, confi
signal(fmt.Errorf("instance closed"))
case err := <-merger.Err:
cmd.Process.Kill()
// Once the command has exited, we might want to let the full console
// output accumulate before we abort the console connection too.
time.Sleep(WaitForOutputTimeout * config.Scale)
if config.Console != nil {
// Only wait for the merger if we're able to control the console stream.
config.Console.Close()
merger.Wait()
}
if cmdErr := cmd.Wait(); cmdErr == nil {
// If the command exited successfully, we got EOF error from merger.
// But in this case no error has happened and the EOF is expected.
err = nil
} else if config.IgnoreError != nil && config.IgnoreError(err) {
err = ErrTimeout
}
// Once the command has failed, we might want to let the full console
// output accumulate before we abort the console connection too.
if err != nil {
time.Sleep(WaitForOutputTimeout * config.Scale)
}
if config.Console != nil {
// Only wait for the merger if we're able to control the console stream.
config.Console.Close()
merger.Wait()
}
signal(err)
return
}
Expand Down

0 comments on commit eaeb5c1

Please sign in to comment.