diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-04-23 12:32:03 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-04-23 15:16:19 +0000 |
| commit | 73a168d010b3ba0a82f850b9fe73e6907539ff20 (patch) | |
| tree | d2142cc472c769438429d694020ae5dc07284c9a /pkg/manager | |
| parent | d971f7e21bf575c68223c77d5bcb784ac4912aa1 (diff) | |
vm/dispatcher: make pool.Run cancellable
Make the pool.Run() function take a context.Context to be able to abort
the callback passed to it or abort its scheduling if it's not yet
running.
Otherwise, if the callback is not yet started and the pool's Loop is
aborted, we risk waiting for pool.Run() forever. It prevents the normal
shutdown of repro.Run() and, consequently, the DiffFuzzer functionality.
Diffstat (limited to 'pkg/manager')
| -rw-r--r-- | pkg/manager/diff.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/manager/diff.go b/pkg/manager/diff.go index 379fd246c..d7860cc9a 100644 --- a/pkg/manager/diff.go +++ b/pkg/manager/diff.go @@ -6,6 +6,7 @@ package manager import ( "context" "encoding/json" + "errors" "fmt" "math/rand" "net" @@ -583,7 +584,7 @@ func (rr *reproRunner) Run(ctx context.Context, r *repro.Result) { // The third time we leave it as is in case it was important. opts.Threaded = true } - pool.Run(func(ctx context.Context, inst *vm.Instance, updInfo dispatcher.UpdateInfo) { + runErr := pool.Run(ctx, func(ctx context.Context, inst *vm.Instance, updInfo dispatcher.UpdateInfo) { var ret *instance.ExecProgInstance ret, err = instance.SetupExecProg(inst, rr.kernel.cfg, rr.kernel.reporter, nil) if err != nil { @@ -595,6 +596,9 @@ func (rr *reproRunner) Run(ctx context.Context, r *repro.Result) { Opts: opts, }) }) + if errors.Is(runErr, context.Canceled) { + break + } crashed := result != nil && result.Report != nil log.Logf(1, "attempt #%d to run %q on base: crashed=%v", i, ret.origReport.Title, crashed) if crashed { |
