Skip to content

Commit

Permalink
run post-run/post-stop task runner hooks
Browse files Browse the repository at this point in the history
Handle when prestart failed while restoring a task, to prevent
accidentally leaking consul/logmon processes.
  • Loading branch information
Mahmood Ali committed Jul 2, 2019
1 parent 3802626 commit 9980239
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client/allocrunner/taskrunner/task_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@ func (tr *TaskRunner) MarkFailedDead(reason string) {
SetDisplayMessage(reason).
SetFailsTask()
tr.UpdateState(structs.TaskStateDead, event)

// Run the stop hooks in case task was a restored task that failed prestart
if err := tr.stop(); err != nil {
tr.logger.Error("stop failed while marking task dead", "error", err)
}
}

// Run the TaskRunner. Starts the user's task or reattaches to a restored task.
Expand Down

0 comments on commit 9980239

Please sign in to comment.