From 079cfb437ddf1a85fd3aa96420b6045f464b0cce Mon Sep 17 00:00:00 2001 From: Danielle Lancashire Date: Wed, 26 Jun 2019 15:20:57 +0200 Subject: [PATCH 1/2] tr: Fetch Wait channel before killTask in restart Currently, if killTask results in the termination of a process before calling WaitTask, Restart() will incorrectly return a TaskNotFound error when using the raw_exec driver on Windows. --- client/allocrunner/taskrunner/lifecycle.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/allocrunner/taskrunner/lifecycle.go b/client/allocrunner/taskrunner/lifecycle.go index 404c9596f..c9fc10a53 100644 --- a/client/allocrunner/taskrunner/lifecycle.go +++ b/client/allocrunner/taskrunner/lifecycle.go @@ -28,18 +28,19 @@ func (tr *TaskRunner) Restart(ctx context.Context, event *structs.TaskEvent, fai // Tell the restart tracker that a restart triggered the exit tr.restartTracker.SetRestartTriggered(failure) + // Grab a handle to the wait channel that will timeout with context cancelation + // _before_ killing the task. + waitCh, err := handle.WaitCh(ctx) + if err != nil { + return err + } + // Kill the task using an exponential backoff in-case of failures. if err := tr.killTask(handle); err != nil { // We couldn't successfully destroy the resource created. tr.logger.Error("failed to kill task. Resources may have been leaked", "error", err) } - // Drain the wait channel or wait for the request context to be canceled - waitCh, err := handle.WaitCh(ctx) - if err != nil { - return err - } - select { case <-waitCh: case <-ctx.Done(): From 65fe89f1c20f99252228024c953d71774c5edb5a Mon Sep 17 00:00:00 2001 From: Omar Khawaja Date: Thu, 27 Jun 2019 14:07:25 -0400 Subject: [PATCH 2/2] make purge parameter lowercase (#5895) --- website/source/api/jobs.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/source/api/jobs.html.md b/website/source/api/jobs.html.md index fc79cb74e..5205b8dc8 100644 --- a/website/source/api/jobs.html.md +++ b/website/source/api/jobs.html.md @@ -1726,7 +1726,7 @@ The table below shows this endpoint's support for - `:job_id` `(string: )` - Specifies the ID of the job (as specified in the job file during submission). This is specified as part of the path. -- `Purge` `(bool: false)` - Specifies that the job should stopped and purged +- `purge` `(bool: false)` - Specifies that the job should stopped and purged immediately. This means the job will not be queryable after being stopped. If not set, the job will be purged by the garbage collector.