Skip to content

Commit

Permalink
Check if driver handle is nil before execing
Browse files Browse the repository at this point in the history
Defend against tr.getDriverHandle being nil.  Exec handler checks if
task is running, but it may be stopped between check and driver handler
fetching.
  • Loading branch information
Mahmood Ali committed Aug 2, 2019
1 parent beeb31e commit 488cd7e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client/allocrunner/taskrunner/task_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,12 @@ func appendTaskEvent(state *structs.TaskState, event *structs.TaskEvent, capacit
}

func (tr *TaskRunner) TaskExecHandler() drivermanager.TaskExecHandler {
return tr.getDriverHandle().ExecStreaming
// Check it is running
handle := tr.getDriverHandle()
if handle == nil {
return nil
}
return handle.ExecStreaming
}

func (tr *TaskRunner) DriverCapabilities() (*drivers.Capabilities, error) {
Expand Down

0 comments on commit 488cd7e

Please sign in to comment.